Results 1 to 2 of 2

Thread: strstr() with a string

  1. #1

    Thread Starter
    Addicted Member Buy2easy.com's Avatar
    Join Date
    Jul 2002
    Posts
    200

    strstr() with a string

    O.K. how do you use the strstr function I just can not figure it out

    or is there something else i can do

    i am reading from a file line by line and sticking it in a string each time i read in a new line i want to be able to search through it for a particular string....for example:

    string Str2BeRead;
    string searcher = "whatever i want";

    say a string is read in and put into the Str2BeRead string. How would i search it for the searcher string? thanks!

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Code:
    Str2BeRead.find(params);
    See the docs on std::string::find() for more details
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

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



Click Here to Expand Forum to Full Width