Thread: Reading spaces, carrage returns, eof from text files

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    30

    Red face Reading spaces, carrage returns, eof from text files

    Dumb newbie question.....

    What. as in characters, would i use to denote a Carrage Return in a string search. As an example if i wanted to find how many carrage returns there were in a file to find the number of lines. I dont need code i just need to know what to search for. Also if i am going to search for spaces and insert spaces i would just search for " " or output a " " right? Or is there a different way a space is denoted in a text files i could use to find the actual spacebar presses not just white space.

    Thanks if you can understand me =)

    Sleep nowww.......
    "...son, what is this COUT << on my birthday card mean?"
    expected ";" line 12, 54, 63, 73....

  2. #2
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Heres a link that might help with your spaces issue:

    http://cboard.cprogramming.com/searc...der=descending

    As your title reads it seems u also meand to ask about end of file? A quick chunck of code for going while its not the end of the file:

    Code:
    do
    {
    ...
    }
    while (!somefile.eof());

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. writing and reading files
    By oldie in forum C Programming
    Replies: 1
    Last Post: 07-03-2008, 04:54 PM
  2. Opening and reading text files
    By pete212 in forum C Programming
    Replies: 3
    Last Post: 04-22-2008, 10:16 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. mygets
    By Dave_Sinkula in forum C Programming
    Replies: 6
    Last Post: 03-23-2003, 07:23 PM
  5. Reading Tab Separted Text files
    By Cathy in forum C Programming
    Replies: 1
    Last Post: 02-15-2002, 10:28 AM