Re: saving Excel data as a file to read in program

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

Juergen Luethje wrote:

>>Excel saves text files with CR *and* NL.
> 
> 
> This is the standard on DOS and Windows. But on Linux, only '\n' is used
> to denote a new line.
> Does that mean that all our programs, which read and write text files,
> are not cross-platform compatible, if we don't explicitly take care of
> '\r' and '\n' anywhere? Fortunately, no! Euphoria handles this for us.
> 
> In %EUDIR%/HTML/lib_h_o.htm#open (Eu 2.4) it reads:
> "Output to *text* files will have carriage-return characters
> automatically added before linefeed characters. On input, these
> carriage-return characters are removed."

> In the following code, Derek used
>    open(..., "r")
> i.e. he opened the file in *text* mode. So the above considerations
> apply. Derek's code is correct IMHO.

You're quite correct (and so, of course, is Derek). I was using the 
code that Derek wrote, and found CR characters in the data I read in. 
That's why I modified the routine. But your post has caused me to look 
further, and the problem is of my own making. I was using a different 
'open file' routine (one that is in my own include, with its own error 
dialogue). That opens the file in *binary* mode, hence the extra 
character.

Thanks for pointing out my error.

-- 
Craig

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

Search



Quick Links

User menu

Not signed in.

Misc Menu