okay for some reason I can't edit my other thread so I'll just make another one. Say I'm using this strtok, it runs like it should but I want it to print out the last string instead of the first when i do a printf at the end.
char *strtok( char *str1, const char *str2 );
char str[] = "now # is the time for all # good men to come to the # aid of their country";
char delims[] = "#";
char *result = NULL;
result = strtok( str, delims );
while( result != NULL ) {
printf( "result is \"%s\"\n", result );
result = strtok( NULL, delims );
}
printf("%s\n", str);
So the output of this is:
result is "now "
result is " is the time for all "
result is " good men to come to the "
result is " aid of their country"
then the last printf shows: "now"
when i would like it to show "aid of their country"
any help?
oh and when i do printf('%s\n", result);
it comes out NULL