Hello everyone,
I am having a bit of trouble getting strtok to tokenize my string. Here is the bit of code that is giving me trouble:
What comes out is this:Code:printf( "%s\n", temp ); strcpy(h, strtok( temp, ":" )); strcpy(m, strtok( NULL, ":" )); strcpy(s, strtok( NULL, ":" )); printf( "%s,%s,%s\n",h, m, s );
That is, the first and third of the three substrings work perfectly but the middle one gives me an empty string when what I want is the "30".Code:14:30:20.555 14,,20.555
Why is it doing that, and how do I fix it?
Thanks,
H.