Thread: How do you search a txt file

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    23

    How do you search a txt file

    How can I have ifsteam go to a sertin token/word/symbol and then read all the info tell the next token/word/symbol?

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    string input;
    getline(inFile, input, '@'); //use whatever char you want
    Last edited by 7stud; 05-10-2005 at 07:40 PM.

  3. #3
    *this
    Join Date
    Mar 2005
    Posts
    498
    seems hes asking how he could start at a symbol and end at one.

    basically same thing but one more statement:

    use an ignore statement to ignore the all the characters up to your first symbol, then use what 7stud wrote to get the input till the next symbol.

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    use an ignore statement to ignore the all the characters up to your first symbol, then use what 7stud wrote to get the input till the next symbol.
    You can certainly use ignore(), but you can also just read in up to the first delimiter, and not do anything with that input.

  5. #5
    Registered User
    Join Date
    May 2005
    Posts
    23
    I need to be able to use more then one simbol becasue I have to tell the difernce per iteam in the file. Can that be done?
    Last edited by kingpinzs; 05-11-2005 at 02:35 AM.

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    You can use whatever symbol you want and change it as often as you like.
    Last edited by 7stud; 05-11-2005 at 02:19 AM.

  7. #7
    Registered User
    Join Date
    May 2005
    Posts
    23
    getline(MapFile , line_buffer, 'obj' );

    this is what I need but it wont let me do it this way.

    I search through the file tell I fond this then end the read when I find 'obj2'

    can that be done. I might understand what you are trying to say

    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  2. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM