Newbie help with search

This is a discussion on Newbie help with search within the C++ Programming forums, part of the General Programming Boards category; Hello, Need a hint on how to search for a piece of text (string) when reading from a txt file ...

  1. #1
    st5
    st5 is offline
    Registered User
    Join Date
    Jul 2003
    Posts
    1

    Newbie help with search

    Hello,

    Need a hint on how to search for a piece of text (string) when reading from a txt file (line by line).

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    strstr()
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    148
    Code:
    std::string text = "Some text";
    if(text.find("...") != string::npos) {
        //We found something
    }

  4. #4
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    st5, use specific subject lines.
    http://www.catb.org/~esr/faqs/smart-questions.html
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 06:20 AM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM

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