I want to split a string into token depending on different delimiters.
e.g. char * temp = "asfs:ggd,oper:eger,ropptujnsdn:hfhgw";
and firstly I want to split data by using "," (lets call a block). and then each block should again split using ":" and save each token's value. then finally I want to store each block(after splitting data inside the block) in a vector. This is the code i wrote 4 that but its not working...........
char * a, *b, *c, *temp;
char str[] ="This,isasample,string";
char * pch;
pch = strtok (str, ",");
while (pch != NULL)
{
printf ("%s\n",pch);
if(!(a = strtok (pch, ":")) ||
!(b = strtok (NULL, ":"))||
!(c = strtok (NULL, ":")))
printf ("%s\n","error");
//else
pch = strtok (NULL, ",");
}