Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 11th, 2007, 1:45 PM   #1
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3 kruptof is on a distinguished road
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:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Jan 11th, 2007, 2:49 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:03 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC