"/R/N" carriage return and line feed

Source: Internet
Author: User

In Windows:
'/R': Press enter to return to the beginning of the current row, instead of the next row;
'/N' line feed, switch to the next line at the current position, instead of returning to the first line;

The origins and differences between carriage return and line feed.
Not displayed on the computer
Previously, there was a teletype Model
33. The tty concept in Linux/Unix also comes from this). It can contain 10 characters per second. However, the problem is that it takes 0.2 seconds to finish a line break
It can be two characters long. If a new character is passed in the 0.2 s, the character will be lost.
As a result, the developers thought of a way to solve this problem, that is, adding two end characters after each line. One is "enter", which tells the typewriter to position the print head on the left boundary, and the other is "line feed", which tells the typewriter to move the paper down one line. This is the source of "line feed" and "Carriage Return". They can also be seen in their English names.

Later, computers were invented, and these two concepts were invented on computers. At that time, memory was very expensive. Some scientists thought it would be too waste to add two characters at the end of each line. Just add one character. As a result, there were differences.

In Unix systems, each line ends with only "<line feed>", that is, "/N". In Windows systems, each line ends with "<line feed> <back
In MAC system, the end of each line is "<press enter>", that is, "/N ";. One direct consequence is that files in UNIX/MAC systems are stored in
If it is opened in windows, all the text will become one line. If the files in windows are opened in UNIX/Mac, there may be an extra ^ m symbol at the end of each line.

C language programming (Windows)

/R means return to the beginning of the row. This overwrites the previous output of this row.

For example:
At last, only Xixi is displayed, and hahaha is overwritten.

Int main ()
{

Cout <"HAHAHA" <"/R" <"Xixi ";
}

/N is the carriage return + line feed, move the cursor first to the beginning of the line, and then switch to the next line, that is, pull the first line of the next line

Int main ()
{
Cout <"HAHAHA" <"/N" <"Xixi ";
}

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.