Now I understand the meaning of carriage return and line feed.

Source: Internet
Author: User
Why does the carriage return record come from:

Before the appearance of PC, secretaries used typewriter to print documents. (Brother is the most famous product version ).
The typewriter is printed with a lead character, and its keyboard is arranged in the same way as the current PC keyboard.
(In view of people's habits, the keyboard layout of typewriter keyboard> terminal keyboard> PC keyboard has almost never changed ).

On the keyboard of the typewriter, in addition to the "enter", there is also a mechanical device --> "Press ENTER", which means to set the print positioning device to the beginning of the line. "Enter" means to take the paper up, but if you do not operate the "Press ENTER" device, the printing position will be the current position.

On a terminal or PC, "enter" (\ n, 0x0a) often indicates a carriage return and a line is upgraded.

In different operating systems, the format of text files is different, such as dos --> Windows, Unix --> Linux,

In the dos --> Windows text file, \ r \ n (0x0d 0x0a) is used to indicate the carriage return and the line is upgraded.
In a Unix --> Linux text file, \ n (0x0a) is used to return a carriage return and to raise the line.

That is, the Unix format or DOS format.

When defining text-based communication protocols, the use of \ r \ n is strictly defined. For example, in HTTP, the end of a line is identified,
\ R \ n is required.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.