Carriage Return - Computers

Computers

In computing, the carriage return is one of the control characters in ASCII code, Unicode, EBCDIC, and many other codes. It commands a printer, or other output system such as a display, to move the position of the cursor to the first position on the same line. It was mostly used along with line feed (LF), a move to the next line, so that together they start a new line. Together, this sequence can be referred to as CRLF.

The carriage return and line feed functions were split for two reasons:

  • Carriage return by itself provided the ability to overprint the line with new text. This could be used to produce bold, underscores, accented characters, strike out text, and some composite symbols.
  • Early mechanical printers were too slow to return the carriage in the time it took to process one character. Therefore the time spent sending the line feed was not wasted (often several more characters had to be sent to ensure the carriage return had happened before sending a printing character). This is why the carriage return was always sent first.

As early as 1901 Baudot code contained separate carriage return and line feed characters.

Many computer programs use the carriage return character, alone or with a line feed, to signal the end of a line of text, but other characters are also used for this function (see newline); others use it only for a paragraph break (a hard return). Some standards which introduce their own representations for line and paragraph control (for example HTML) and many programming languages treat carriage return and line feed as whitespace.

In ASCII and Unicode, the carriage return is defined as 13 (or hexadecimal 0D); it may also be seen as control+M or ^M. In the C programming language, and many other languages influenced by it, \r denotes this character.

Read more about this topic:  Carriage Return