What is the difference between \ n and \ r?

Possible duplicate:
What is the difference between \ r and \ n?

Hello,

What is the difference between \n(new line) and \r(carriage return)? Both of them move the current cursor to the next line. Are they the same?

+5
source share
6 answers

\rreturns the cursor to the beginning of the line, and not to the next line. When you use \non Linux, it is implied \rin windows it is not.

Use \ron Unix-like systems may overwrite the same line.

+11
source

I suggest you read this .

, Windows - "\r\n", Unix - "\n" (, , Macs "\r")

+8

, . , .

\r\n Windows \n Linux. Mac \r, \n .

(: / )

+2

, . , , .

\r " ". , , .

\n, , , . . , , .

Telnet - , .

ascii- , , spec'd, , , , .

0

...

, . :

  • "" ( ) ( ).
  • . ( , )

, ( !). , ( , , ).

1 1 \r \n "".

Currently, the main operating systems, apparently, have different opinions about the fact that this is still necessary for computer technology, when returning to the previous position is much easier. However, in modern programming languages ​​you usually see what is \nsupposed to be equal \r\n.

0
source

All Articles