1. line terminator
- Posted by George Walters <gwalters at sc.rr.com> Oct 11, 2004
- 418 views
What is the normal line terminator for ascii files (dos/win) CR, LF or both? I had a bug and found that the last line in the file had no CR, LF but all the other lines had a CR. I'm wondering if I ported the files incorrectly from brand x operating system. (Theos OS). george
2. Re: line terminator
- Posted by "Kat" <gertie at visionsix.com> Oct 11, 2004
- 409 views
On 11 Oct 2004, at 9:41, George Walters wrote: > > > What is the normal line terminator for ascii files (dos/win) CR, LF or both? > > I had a bug and found that the last line in the file had no CR, LF but > all the other lines had a CR. I'm wondering if I ported the files > incorrectly from brand x operating system. (Theos OS). I have found it is best to always check every file you read (unless you wrote it in an Eu program) for which combination of line terminators. A text editor may save it one way, a browser another way, any webpage may be backwards, the OSs are different, the option of the ftp downloader may change the file, etc etc. I never parse on \n anymore, i always parse on {10,13} now. Also, when you use Eu to open a file for reads or writes, save yourself some grief and use the "b"(inary) option. Kat
3. Re: line terminator
- Posted by h4x3r <h4x3r at bellsouth.net> Oct 11, 2004
- 415 views
On Mon, 2004-10-11 at 09:41 -0400, George Walters wrote: > > > What is the normal line terminator for ascii files (dos/win) CR, LF or both? > > I had a bug and found that the last line in the file had no CR, LF but > all the other lines had a CR. I'm wondering if I ported the files > incorrectly from brand x operating system. (Theos OS). > > george Hi George, integer crlf if platform() = LINUX then crlf = 10 else crlf = 13 end if just a thought...perhaps there's more to this Regards, -- h4x3r <h4x3r at bellsouth.net>
4. Re: line terminator
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Oct 11, 2004
- 431 views
On Mon, 11 Oct 2004 09:41:10 -0400, George Walters <gwalters at sc.rr.com> wrote: >What is the normal line terminator for ascii files (dos/win) CR, LF or both? > >I had a bug and found that the last line in the file had no CR, LF but >all the other lines had a CR. I'm wondering if I ported the files >incorrectly from brand x operating system. (Theos OS). > The last line of a file does not always have a line terminator. Create a file in say notepad: Just enter "hello", - but do not key return - and there will be no CR's or LF's anywhere in that file. Regards, Pete
5. Re: line terminator
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 11, 2004
- 432 views
- Last edited Oct 12, 2004
George Walters wrote: > > What is the normal line terminator for ascii files (dos/win) CR, LF or both? > > I had a bug and found that the last line in the file had no CR, LF but > all the other lines had a CR. I'm wondering if I ported the files > incorrectly from brand x operating system. (Theos OS). It's my understanding that DOS/Windows uses the combination 13-10, unix uses 10, and Macintosh uses 13. This applies to all lines except the last one. The line terminator is optional for the last line. Additionally, DOS/Windows may follow the last line with 26. A few things to remember though: ** Not everyone follows this convention perfectly. ** Euphoria deals with this detail internally and always replaces 13-10 combinations with just a 10 for you. ** Some text files read on one operating system may have been created on another. If you don't know exactly how the file was created, open it in binary mode and then assume any combination of CR & LF terminates a line, and that the last line might not have either CR or LF. -- Derek Parnell Melbourne, Australia