Before learning to compile, always do not know the teacher in the line, always hit a newline character and carriage return , originally they have such a story ....
A long time ago, there was a machine called a Telex typewriter (teletype Model ASR) , and there was no such thing as a computer. On this typewriter, there is a part called carriage , it is the type head, the equivalent of the typewriter cursor. Each character is entered, and the cursor advances one cell. When you enter a word Fu a line, the cursor re-prints from the leftmost side of the next line .
This time will trigger two actions, one is to move the cursor in the vertical direction, one is the horizontal direction of the cursor to the leftmost. Then the typewriter can be 10 characters per second, equivalent to 0.1 seconds to play a character, and to complete these two actions will take 0.2 seconds, if in this 0.2 seconds, if there are new characters sent over, then these characters will be lost.
To address this missing character, the developer adds two characters after each line that indicate the end of a line: a return (carriage return), equivalent to telling the typewriter to move the cursor horizontally to the far left; a line Feed), which is equivalent to telling the typewriter to move the cursor to the next line in the vertical direction.
This is the origin of the carriage return and line breaks .
Later, the computer appeared, the two concepts were also taken over. But when the storage device was very expensive, some people thought that using two characters to denote the end of a line was very wasteful, so a branch was created, and different vendors had different ways of handling it.
In these operating systems, the UNIX operating system ends with a newline at the end of each line, which is "\ n"; Windows is a carriage return + newline , that is, "\ r \ n", while the Mac system uses a carriage return to represent the end, that is, "\ r".
It is for this reason that we sometimes use the Windows system to open Unix/mac system files when all the text becomes a line, while the UNIX and Mac systems open the Windows system files, at the end of each line will be a ^m The character.
Finish
Pay attention to the public my number: hard yards of farmers , get more original articles, backstage reply gift package to send you a special resource package.