"Carriage return" "newline" symbol basic meaning
general |
meaning |
Symbol |
symbol English |
control character (meaning) |
carriage return |
cursor back to bank start |
\r |
return |
CR (carriage Return) |
newline |
cursor down one line |
\n |
newline |
lf (line Feed) |
line terminator for different operating systems
Operate System |
Symbol |
Significance |
Windows |
\n\r |
System line terminator, that is, use the Windows user often said carriage return line |
UNIX, Linux |
\ n |
System line terminator, which is carriage return + line break |
MAC OS |
\ r |
System line Terminator |
Carriage return line and multi-language programming
1. C + +, text files, Windows
Output B will overwrite a, ' \ R ' returns to the beginning of the line
Cout<<string a<<"\ R"<<string B;
Outputs A and B, ' \ n ' that returns a line break
Cout<<string a<<"\ n"
Problem L: Because the build is still \n\r, so even the cout<< "\ n" will be able to change the line to enter correctly?
2. Java split the article string, use ' \ r \ n ' in Windows, use ' \ n ' in Linux, or get the system default line break
3. text file with two newline characters LF and CR+LF, either Windows or UNIX, LF will not display properly, i.e. no newline
Inline base _ Carriage return line break