i will explain with example
char *string="<fdsjfdsfssassd>nbjnj&asdas>dsfds>"
now i want to delimit the string using ">"
char *str=strtok(string,">");
after tht if i found "&" then we delimit the string with "&"
if(strchr(str,'&')!=NULL)
str1=strtok(str,"&");
after i will continue the process until all ">" removed
so
Code:
char *string="<fdsjfdsfs&sassd>nbjnj>dsfds>"
char *str=strtok(string,">");
while(str!=NULL)
{
str1=strtok(NULL,">");
if(strchr(str1,'&')!=NULL)
str2=strtok(str1,"&"); //here is the problem
}
once the strtok with "& "executed . the "strtok(NULL,">");" is refrence the str1 string not str .
thank u
sree