Hello guys! :)

I just wanted to ask something so that I can clear up things in my mind.

What is the difference among Carriage Return ('\r'), New Line ('\n') and Line Feed?
Is it correct to say that \n = \r + LF ?

Thank you in advance! :)

Back in the days when computers used line printers to communicate, a carriage return actually caused the printer to push the carriage (print head) back all the way to the left. A line feed, on the other hand, caused the paper to advance by one line without moving the carriage. So, to go from the end of one line to the beginning of the next took both (in either order). Then Unix and C came along and in C, Brian Kernighan and Dennis Ritchie decided that almost always, you actually wanted both, so they invented the 'new line' character ('\n') which is translated "under the covers" into whatever is needed for the output stream.

On Linux and Unix systems, '\n' is usually a single character (usually line feed). Windows still does the 'right thing' by using both characters for '\n', and those are used in CR-LF order. Older Macs also used two, but in LF-CR order (OS/X uses the Unix standard).

Wikipedia has a slightly different (and much longer) take on all of this.

Well, thank you very much for your most descriptive explanation! :)
That sure cleared a lot of things for me! :)

This question has already been answered. Start a new discussion instead.