findin' word in a line

This is a discussion on findin' word in a line within the C Programming forums, part of the General Programming Boards category; i want to look for a certain word in a line(stored in a array) and then copy alll the chars ...

  1. #1
    BEEP BEEP
    Guest

    findin' word in a line

    i want to look for a certain word in a line(stored in a array) and then copy alll the chars following it in another array untill a certain character like' > ' is encountered.What string function i should used?

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>strtok()
    Might not be the best function to use, as it changes the contents of the original string.

    To find a string within a string, use strstr . To find a character within a string, you can use strchr, but based on your requirements, I'd probably build my own parser. Besides, building it yourself is more educational
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  3. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21