\ r \ n difference, \ r \ n or \ r difference (C language/c#)

Source: Internet
Author: User
\ r means carriage return, \ n means line break, when we press the return button, the system automatically generates a carriage return and a newline of two characters:
A carriage return is only a completion, and the cursor is returned to the beginning.
Wrapping is just wrapping, not completing, or putting the cursor at the beginning of the line.
Example: (the cursor is represented by I below)
1--
After output abcdef:
ABCdef I
2--
After output carriage return:
Iabcdef
2--'
If it is an output line wrap:
ABCdef
I
3--
Output carriage return and line wrapping:
ABCdef
I
Use the C language to test the difference between carriage return and line wrapping: Assuming that the current cursor position is 5 rows 10 columns, after the output carriage return, the cursor position becomes 5 rows 1 columns, if the output is the line break is 6 rows 10 columns, if the output carriage return and the wrapping line is 6 row 1 rows.
If you want to output \ r or \ n such content, you need to use this method:
Console.Write ("\\r\\n");
Or
Console.Write (@ "\ r \ n");
Enter the two character return and line break after entering the carriage return

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.