\ n Soft return:
Represents a newline and returns to the beginning of the next line in Windows. Equivalent to the effect of \ r in Mac OS.
In Linux, Unix only means wrapping, but does not go back to the beginning of the next line.
\ r Soft Space:
In Linux and UNIX, the representation is returned to the beginning of the line.
Represents a newline in Mac OS and returns to the beginning of the next line, equivalent to the \ n effect in Windows.
\ t jumps (moves to the next column).
They are valid in double quotes or in a string represented by a delimiter, and are not valid in a string of single quotes.
\ r \ n is commonly used to represent the return key on the keyboard, or only \ n.
\ t represents the "tab" key on the keyboard.
As you use Enter and Shift+enter, if the effect you want to display on the page is translated into HTML code or ...
NewLine symbol in File:
Linux,unix: \ r \ n
Windows: \ n
Mac OS: \ r
Corresponding:
\ n lf or 0x0a in ASCII (10)
\ r 0x0d in CR or ASCII (13)
\ t Horizontal tab-HT or 0x09 in ASCII (9)
\ reverse Slash
\$ Dollar character
\ "Double Quotes
\ ' Single quotes
About their origins and causes differences in the scale of the original by:
The origins and differences between the two concepts of "enter" (carriage return) and "line feed".
Before the computer appeared, there was a device called the teletype Model 33, which could play 10 characters per second. But it has a problem, that is, after a line of line change, to use 0.2 seconds, just can hit two characters. If there are new characters coming in this 0.2 seconds, the character will be lost.
So the developers figured out a way to solve the problem by adding two characters to the end after each line. One is called "carriage return", which tells the typewriter to position the print head at the left edge, and the other is called "line-wrapping", telling the typewriter to move the paper down one line.
This is the "line" and "return" of the history, from their English name can also be seen in one or two.
Later, the computer was invented, and the two concepts were also on the computer. At the time, memory was expensive, and some scientists thought it would be a waste to add two characters to the end of each line. So, there was disagreement.
In a UNIX system, the end of each line is only "< newline >", that is, "\ n"; Windows system, each line at the end of "< line >< Enter >", that is, "\n\r"; Mac system, the end of each line is "< Enter >". A direct consequence is that all text becomes a row when the files under the UNIX/MAC system are open in Windows, and Windows files open under Unix/mac, and a ^m symbol may be shown at the end of each line.
C Language Programming (Windows system)
\ r is the return line, which will overwrite the previous output
Such as:
Copy Code code as follows:
int main () {
cout << "hahaha" << "\ r" << "Xixi";
}
The last one shows Xixi and hahaha back covers.
\ n is a carriage return + newline the cursor is moved to the beginning of the line and then to the next line, which is the beginning of the next line.
Copy Code code as follows:
int main () {
cout << "hahaha" << "\ n" << "Xixi";
}
is displayed:
hahaha
Xixi