I am reading a separate .txt
file and grabbing each line. Then I am using strtok to manipulate each string. I have a #define macro:
#define DELIMS "!\"#$%&()|'*+,?/:;<=>@[\092]^_{}~\177\t\ "
In the DELIMS I have a space at the very end. When I use this to split up a string, using this in the strtok, it isn't using the space as one of the delims. Am I doing something wrong?
void splitLine(char string[], int count)
{
char *ptr, *word;
for (ptr = string; word = strtok(ptr, DELIMS); ptr = NULL)
printf("%s", word);
}
OUTPUT
define FLUSH while
It is displaying the three words in one printf
instead of displaying each word one at a time.