![]() |
|
#1
|
|||
|
|||
Problems in Counting Lines in Text FileProblems in Counting Lines in Text File
A Portion of my file read code to count lines: CPP / C++ / C Code:
The linecount stays at a permanent 0 |
|
#2
|
|||
|
|||
|
You should be looking for '\n' as a character and not as a "\n" which is string notation.
change your inner if condition to CPP / C++ / C Code:
|
|
#3
|
||||
|
||||
|
Quote:
... and in.eof() will 'read' one extra character or line. Another option is to read the file using getline() and count how many times it read rather than char by char testing each one. __________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
Recent GIDBlog
Toyota - 2008 November Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 11:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 12:28 |
| Can't view pages from another machine on the Intranet | aevans | Apache Web Server Forum | 9 | 14-May-2004 03:26 |
| Re: Programming Techniques | WaltP | C Programming Language | 0 | 10-Mar-2004 00:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The