i have string like that
update std set name=test,phone=8787898 where id = 10
i want to split it into tokens using space and =, delmiters i'm using the follwoing code
the probleme is that i can not select where token the pointer at that stage is NULL
how to make it point to where
pch=strtok(str," ");
while(pch !=NULL)
{
if(strcmpi("update",pch)==0) {
pch=strtok(NULL," ");
if(strcmpi("std",pch)==0)
{
pch=strtok(NULL," ");
if(strcmpi("set",pch)==0)
{
pch=strtok(NULL," "); pch= strtok(pch,"=,"); if(strcmpi("name",pch)==0)
{
pch=strtok(NULL,"=,"); pch=strtok(NULL,"=,"); }
if(strcmpi("phone",pch)==0)
{
pch=strtok(NULL,"=,"); pch=strtok(NULL,"=,"); }
pch=strtok(NULL," "); if(strcmpi("where",pch)==0)
{
printf("where selected");
}
}
}
}
}