* Smylers <[email protected]> [2008-10-10 19:40]: > Which characters? The representation \r denotes a carriage > return, aka character \x0D. > > Whereas \n denotes a 'new line', a virtual concept which is > made up of some concept of some combination of line feeds > (\x0A) and carriage returns, in an attempt to cope with the > hateful different ways OSes have denoted line breaks.
That's actually totally wrong! It's a very misconception, though, one that I believed for a long time myself. What actually holds true is that on Windows, the C runtime library will translate `\r\n` into `\n` during input and vice versa on output, unless you `binmode` the filehandle, in which case no translation happens. Also, on MacOS Classic `\n` means `\x0d` instead, and is the same as `\r`. This is true for C programs on that platform as well. And of course, on non-ASCII platforms (basically, EBCDIC) these shorthands refer to other codepoints. (Basically this means that MacOS Classic is only an *almost*-ASCII platform.) But `\n` always means *exactly one character* which on ASCII systems is always `\x0a`. There is nothing magical or virtual about `\n`. Period, end of story. (I realise I didn't explicitly hate on anything, but if you don't think the above conglomerate isn't hateful, I can't help you.) Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>
