Hi,
I'm new to this site so apologies for any mistakes. I'm trying to write a program to parse string from a file. In each string I then have to parse the different strings for example:
add h'13', 4
So I've to parse the 'add' bit, the '13' bit and the '4' bit. At the minute I'm trying to use strtok but I'm getting a run time error.
/* Libraries */
#include <stdio.h>
#include <string.h>
/* Main Function */
int main()
{
/* Declarations */
char *instruction;
char *action;
char *number;
char *number2;
instruction = "add h'13', 4";
printf("%s \n",instruction);
// The run time error occurs here
action = strtok ( instruction, " " );
number = strtok ( NULL, " ' " );
number2 = strtok ( NULL, "," );
printf("%s \n %s \n %s \n", action, number, number2);
system("PAUSE");
return 0;
}
Any help you can give me would be greatly appreciated. Thanks.