Linux,windows,mac different representations of line breaks under OS

Source: Internet
Author: User

Initially programmed with Liunx, the platform for Learning programming was recently transferred to a Mac. In the meantime there are some problems, especially the line break. When you use an input/output function such as scanf, the expected line-wrapping effect does not occur when you are swapping lines.

Originally, on the three main platforms, the line break's representation is not the same.

In Unix systems, the end of each line is only "< line-wrap >", or "\ n".

Inside the Windows system, each line ends with "< enter >< wrap >", or "\ r \ n".

Mac system, the end of each line is "< Enter >", that is, "\ r".

In this case, if the file under the Unix/mac system is opened in Windows, all the text will be turned into one line, and if the file in Windows is opened under Unix, it will be more than a ^m character at the end of each line.

Linux,windows,mac different representations of line breaks under OS

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.