The Difference
There are a few characters which can indicate a new line. The usual ones are these two:
* '\n' or '0x0A' (10 in decimal) -> This character is called "Line Feed" (LF).
* '\r' or '0x0D' (13 in decimal) -> This one is called "Carriage return" (CR).
Different Operating Systems handle newlines in a different way. Here is a short list of the most common ones:
* DOS and Windows
They expect a newline to be the combination of two characters, namely '\r\n' (or 13 followed by 10).
* Unix (and hence Linux as well)
Unix uses a single '\n' to indicate a new line.
* Mac
Macs use a single '\r'
.
Taken from Here