New line

The concepts of line feed (LF) and carriage return (CR) are closely associated, and can be either considered separately or together.

https://en.wikipedia.org/wiki/Newline

What is the difference between and ?

They're different characters. is carriage return, and is line feed.

On "old" printers, sent the print head back to the start of the line, and advanced the paper by one line. Both were therefore necessary to start printing on the next line.

Obviously that's somewhat irrelevant now, although depending on the console you may still be able to use to move to the start of the line and overwrite the existing text.

More importantly, Unix tends to use as a line separator; Windows tends to use as a line separator and Macs (up to OS 9) used to use as the line separator. (Mac OS X is Unix-y, so uses instead; there may be some compatibility situations where is used instead though.)

For more information, see the Wikipedia newline article.

EDIT: This is language-sensitive. In C# and Java, for example, always means Unicode U+000A, which is defined as line feed. In C and C++ the water is somewhat muddier, as the meaning is platform-specific. See comments for details.

 

mag344tt.rmb

原文地址:https://www.cnblogs.com/simoncook/p/5933869.html