I've been developing some code that parses output reports and re-reports on information that is of interest. I utilize strtok quite heavily in this program and I have run into the situation where my final strtok call may or may not return some info. Depending on if there is info returned will dictate my branch in an IF statement. Code snipit:
while (fgets(buffer, 133, ofp) != NULL)
if (!strncmp(&buffer, "Queue:", 6))
if (strncmp(&buffer," ",10))
len = strlen(&token);
if (len <= 0)
If the last call to strtok does not find anymore info, i.e. token becomes NULL, then if I do the strlen call the code blows up at runtime. token is defined as char *token. I have tried the strlen command with token, *token (doesn't compile), &token and &token. Any suggestions?