Windows, Unix, Mac line breaks for different operating systems-parse carriage return \ r and newline characters \ n

Source: Internet
Author: User
Tags ftp client

Reprint Link: http://blog.csdn.net/tskyfree/article/details/8121951

First, the concept:

line feed ' \ n ' and carriage return ' \ R '

(1) NewLine character is another line---'\ n' 10 newline (newline)

(2) The carriage return is back to the beginning of the line---'\ r' 13 return car (return)

So we usually write the file carriage return should be exactly called carriage return line break

Second, the application:

(1) in MS-DOS and windows in Microsoft, use "carriage return CR (' \ R ')" and "newline LF (' \ n ')" two characters as newline character, (2) inside the Windows system, each line ends with a carriage return + line feed (CR+LF), i.e. "\ r \ n" ; (3) in UNIX systems, each line ends with a newline CR, or "\ n", and (4) the Mac system, where each line ends with a carriage return CR that is ' \ R '. third, Impact:(1) A direct consequence of this is that the files in the UNIX/MAC system open in Windows, all the text will become a line, (2) and the Windows file under Unix/mac Open, at the end of each line may be more than a ^m symbol. (3) A black dot appears on a Linux saved file that is viewed in Notepad on Windows. four, can be converted to each other: Under Linux, the command Unix2dos is to convert the Linux file format to the Windows file format, and the command Dos2unix to convert the Windows format to the Linux file format. When transferring files between different platforms using FTP software, in ASCII text mode transfer mode, some FTP client programs automatically convert to the line format. The number of file bytes passed through this transfer may vary. If you do not want FTP to modify the original file, you can use bin mode (binary mode) to transfer the text. A program runs on Windows to generate a text file in CR/LF format, while running on Linux generates a text file with the LF format wrapped.

Windows, Unix, Mac line breaks for different operating systems-parse carriage return \ r and newline characters \ n

Related Article

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.