'\r' is simply a carriage return whereas '\n' is a carriage return followed
by line feed. Note that a carriage return is simply that, it moves the
cursor to the beginning of the current line and does not move on to the
next line.
No, you should not look on a spezific implementation for that:
\n newline. On one implementation it may be 0x0a,
on another it may be 0x0d, on a third it may be 0x0d0a
on another it may be something else
\r return. on some implementations it is 0x0a
on others it may be something else
\t tab. Often it is 0x09 but other implementations may
use something else
\b bell
\f formfeed
and some more symbolic constant refering to a specific hardware
function - but having different binary codes in different
implementations.
Always get the meaning, not the binary representation. On Win, DOS and
so on \n is 2 binary characters in file, on the stream different:
binary: two, text: only one. On other implementations its only one but
been different to others.
It is here you have to be careful as UNIX text files are of a different
format from Windows text files and need conversion when moving from one o/s
to the other.
There are clearly more implementations with different meaning of them.
It is the C runtime that converts 0x0d0a to only \n - and reverse in
DOS/Win text streams. It is the C runtime that converts \n to 0x0a and
reverse on MAC, it is the C runtime that converts another char(s)
from/to \n.
So whenever you has to handle a text stream use the codes (e.g. \n für
newline). Be sure that you can fall into hard compatibility problems
when the stream does NOT ordinate from your system or is destinated to
another. Yeah, there are filters around that will convert text files
from one system to another and back. Use them to im/export files from
other systems.
When you use a network like tcp/ip the network will do that under
cover for you - except you have to write something on low level.