![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3
![]() |
Unintentional end of line detection?
I know this is not c++ specific but it is the implementation langauge i am using, if it is in the wrong category please feel free move it.
when reading through a file to determine the amount of lines in that file, if i check for the end of line character which is \n i only get a count of how many times the user purposely terminated a line, some times a line might not be terminated by hitting the retun key or whatever causes the \n, but it might be terminated by any other characters like when u have sentences that go over several lines, i cannot seem to find how to do this, is their any special characters that i should be looking out for, that will allow me to detect this sort of behaviour.
__________________
Quote:
|
|
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
A line is a line in the file, and is indicated by the presence of a newline (LF, \n), carriage return (CR, \r), or both, depending upon the system. That's for the huge majority of cases you will run up against. You are talking about word-wrap. That's a presentation thing, not a file thing. If you have a file prepared in one of the ways listed above, and it's interpreted by a system that uses one of the other ways, you may get long lines that don't wrap, or blank lines due to the double (\r\n). Again, it's a presentation or interpretation thing. You may get similar effects if the file were written (in Windows) in text mode and read in binary mode.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ackerman's function - crash upon launch | codylee270 | C++ | 6 | Oct 19th, 2006 3:14 AM |
| New programming challenge | DaWei | Other Programming Languages | 20 | Jul 8th, 2006 12:23 PM |
| Help in QBASIC (I think it's similar to VB) | phoenix987 | Visual Basic | 3 | May 9th, 2005 1:33 PM |
| Help with a QBASIC program | phoenix987 | Other Programming Languages | 4 | May 5th, 2005 1:27 PM |
| Installing IPB 2.03 | bh4575 | Other Web Development Languages | 0 | Apr 23rd, 2005 3:36 AM |