I am having some problems parsing a certain string. First let me explain what I'm trying to do. This is just a small component of a much larger program.
The string that I have to parse has this format:
..etcCode:name1 name2 name3 name4 name5
and i want each of the names to be checked seperately by another function. Hence each name has to be somehow parsed indiviodouly. I am trying to basically seperate and analyze each of those name.
This is what I have so far...and I'm stuck.
Code:
char *names, *buffer, nicks[16], *temp;
buffer = strtok(names, " ");
strcat(nicks, buffer);
sprintf(temp, "%s ", nicks);
do
{
buffer = strtok(names, temp);
strcat(nicks, buffer);
sprintf(temp, "%s ", nicks);
printf("%s\n", temp);
//launch function to process that name
//unimportant in this context
}while(buffer != NULL);