|
-
January 27th, 2013, 07:20 AM
#4
Re: token going null on second itteration of loop
strtok returns a pointer to the next token found in the specified c-string. It returns NULL when no more tokens are found. Each call modifies the provided c-string by substituting a NULL character in the string for each delimiter that is encountered. As cilu said
I guess it's null because the second call to strtok (NULL, ",") just returns NULL
I suspect that the data read into inputbuffer is not always what you are expecting. You have no checking on the format of this and are assuming it is always right.
What are you trying to accomplish?
As Paul requested, please provide some actual data and a small complete program that demonstrates the problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|