HELP C++ (Tokenization)

Sharky Forums


Results 1 to 2 of 2

Thread: HELP C++ (Tokenization)

  1. #1
    Expensive Sushi
    Join Date
    Sep 2000
    Posts
    40

    HELP C++ (Tokenization)

    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?

  2. #2
    Tiger Shark
    Join Date
    Oct 2000
    Location
    Erie, PA, USA
    Posts
    693
    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.
    AMD AthlonXP 2600+ Thoroughbred B @ 200x10.5
    Shuttle AN35N nForce2 Ultra 400
    2x512MB Kingston PC3200 (3-3-3)
    ATI Radeon 9600 Pro
    40GB WD ATA-100 8MB cache
    Creative 12X DVD Drive
    Memorex 52X CD-RW
    Running Windows XP Pro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •