Scanning a text file.

This is a discussion on Scanning a text file. within the C++ Programming forums, part of the General Programming Boards category; I have a project I need to do in which I need to look at a file, scan it, and ...

  1. #1
    Unregistered
    Guest

    Scanning a text file.

    I have a project I need to do in which I need to look at a file, scan it, and show any occurances of C++ operators or variables. Like finding how many times int is shown.

    The only help I'm looking for is could someone point me to, or show me, how I would scan a text file character by character and check it? There's a lot more to the project, but I can do that on my own. This is the part I'm stuck on.

    Thanks in advance.

  2. #2
    Unregistered
    Guest
    Also, how would I get a string input of word?

    I know how to compare it, but how would I get the input of it?

    Example is I find the word "dog" in the text file, and I want to compare it to a table or whatever of words, and match it with "dog" and mark an occurance of it. Basically like what a find function does.

  3. #3
    Unregistered
    Guest
    Well, after tinkering with it, I got it to scan and print out the text file just fine. But I'd still like to know how to scan words at a time rather than just comparing character by character.

    I'd like to know how to stop scanning after a return or space, put what I've scanned into a buffer, then compare. Is there a easier way to do this than just manually pounding out code?

    Thanks.

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    53
    Continuing this line of thought........ is there any support available in C/C++ for regular expressions?

    Almosthere
    "Technology has merely provided us with a more efficient means for going backwards" - Aldous Huxley

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 01:36 PM
  2. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM

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