Re: Mac text files and gets()

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

Robert Craig wrote:
> Don't make the rest of us DOS/Windows users have to worry 
> about the line terminator standards of foreign systems.
> The DOS/Windows "\r\n" nonsense is already complicated enough.

I'm now thinking that you haven't understood what Chris is attempting to do. In
short it is to ensure that DOS/Windows (and Linux) users do not have to worry
about line terminators when reading a text file. This is to be done be converting
the 'native' terminator into the standard Euphoria terminator of '\n'.

I think that if a text file, being read in any environment, is found to contain
a carriage-return in isolation, it is a reasonable assumption that it is intended
by the file's creator that it represents the end of a text line. Under what
circumstances would a '\r' by itself, in a text file, literally only means "move
the cursor to the begining of the current display line" (which is what carriage
return means).

DOS uses the "\r\n" because of the teletype convention of \r moving the cursor
to the leftmost position and \n moving the cursor down one line - the net result
is that a "new line" is now ready to receive input. I agree it is anachronistic
but we are stuck with it. Unix, Mac and IBM, have all implemented a much better
paradigm in which a single character acts as a line delimiter - but why couldn't
they have choosen the same character!

Currently, Euphoria enables its coders to avoid worrying about DOS/Unix
differences so why not extend that to Macintosh files? I obtain text files via
FTP, wget, etc ... from various servers around the world and I shouldn't have to
worry about which operating system the file was created under.

As for Chris' proposed implementation, it is not set in concrete and I'm sure
that collectively, we can develop the best way to do this.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

Search



Quick Links

User menu

Not signed in.

Misc Menu