Re: line terminator

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu