Click to See Complete Forum and Search --> : HELP C++ (Tokenization)


AcerX
09-20-2002, 04:08 PM
Hi,
I'm trying to tokenize a string, for example"This is a <test>".
I used
char string[]="This is a <test>";

tokenPtr=strtok(string," ");
while(tokenPtr!=NULL){
printf("%s\n", tokenPtr);
tokenPtr=strtok(NULL, " ");

The output is ok except I want to eliminate the term with < >.
Can anyone tell me how do I make the function skip the unwanted term?

Malone
09-27-2002, 06:25 PM
where does your while loop end? Can you post the rest of the code? I'm not real familiar with C++, is strtok() a library function? Are you trying to get rid of "test" or "<test>"? We're all happy to help each other here, but I think we need a little more explanation on this one. :)