Re: OK what does ` mean - seriously seems to be not documented.

new topic     » goto parent     » topic index » view thread      » older message » newer message
gimlet said...

If \r\n is a relic then it is quite a recent relic. And wasn't it true that Mac lines were terminated with \r not \n? (This has no doubt changed now).

Correct. The Macintosh operating system used to use CR as the end-of-line marker in text files. It now uses LF since it adopted a modified unix base.

gimlet said...

My concern originally was whether my program needed to support ` and """ when reading in values from text files.

I would like it to know the \r was there.

And this is where we might have been confused. The back-tick and double-quote notation is only applicable to string LITERALS in your source code text, not in text files in general.

Normally, an application doesn't have to know if the text file its reading/writing has CR/LF/or CRLF line endings because the library's functions handle all that for you. Your application always 'reads' a LF regardless of the platform its running on and always outputs the appropriate line ending for the platform you are running on.

If, however, your application must actually know if a CR etcetera was on the disk text file, you need to open the file as a 'binary' file and process the incoming bytes yourself. I realize that there may be real applications that need to know, but really, why bother? Why do you need this?

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

Search



Quick Links

User menu

Not signed in.

Misc Menu