Advertisement

Difference between \n and \r ?

Started by March 30, 2002 12:08 PM
1 comment, last by romer 22 years, 9 months ago
I''ve read about \n and \r in a book I have and I know \n writes the newline character and \r is for a carriage return, but I don''t really know what the difference between the two. Don''t they both just cause the cursor position to go to the start of the next line?
That goes back to the days of typewriters:
Carriage Return (\r) brings the "carriage" (the thing that types) to the beginning of the current line
Line Feed (\n) feeds the page one line down, but does not touch the carriage, so it will stay in the same place, but one line lower.
Advertisement
Thank you pouya for making it clear.

This topic is closed to new replies.

Advertisement