Wednesday, 15 January 2014

c++ - Meaning of \r on linux systems -



c++ - Meaning of \r on linux systems -

i'm looking @ linux specific code outputting likes of:

\r\x1b[j>

to std io.

i understand <esc>[j represents deleting contents of screen current line down, \r here?

i'm seeing following:

>user_input\n\r>

where user_input text entered user. purpose of \r here?

the character '\r' carriage return. returns cursor start of line.

it used in net protocols conjunction newline ('\n') mark end of line (most standards specifies "\r\n", allows wrong way around). on windows carriage-return newline pair used end-of-line. on old macintosh operating scheme (before osx) single carriage-return used instead of newline end-of-line, while unix , unix-like systems (like linux , osx) uses single newline.

c++ linux bash terminal vt100

No comments:

Post a Comment