I have this extremely strange behavior coming :
In the below code: If I comment the call to MyLogger then everything works fine that is I get the sTempNr tokenized and 4 tokens are printed . But if I uncomment the call to MyLogger for logging then only the iteration takes place once and in other testing class with similar code as below there is a looping taking place more than 4 times with redundant info being sent to MyLogger.
So, I checked with Purify tool to determine if there were some memory issues in MyLogger. Could not find any. MyLogger is using vaargs to extract args and vfprintf call to print.
I am not sure how to debug this code further. Any guidance would be appreciated!.
char sTempNr[41] = "1129Z13589.2.9.10";
char *sTempStr;
sTempStr = NULL;
sTempStr = strtok(sTempNr,".");
while (sTempStr)
{
printf("in in TempStr[%s]\n",sTempStr);
//MyLogger("write","","Temp String[%s]",sTempStr);
sTempStr = strtok(NULL,".");
}