What is Carriage Return?
In pre-computer days, typewriters were equipped with a lever on the left-hand side known as a carriage return. When pressed, the mechanism sent the paper-holding cylinder, or carriage, to the right, and at the same time, rotated the paper upward to begin a new line. Eventually, a power return was created that was pressed with the little finger on the right hand. This feature was first added to electric typewrites in 1960 by Smith Corona.
The carriage return, or just “return” for short, is now known as the enter key and is labeled with a backward arrow symbol (↵). This key serves the same function as the original lever, moving the cursor to the beginning of the next line. With the advent of word wrap, however, it was no longer necessary to press return at the end of each line. Now, the enter/return key is known as a hard return and is used only at the end of a paragraph.

Carriage return also refers to the symbol, command, or key that causes the printer to be positioned, or the cursor to be displayed, at the left margin. It also controls paper feeding. In ASCII or Unicode, the character code decimal 13 represents it. In some programming languages, such as C, UNIX, Java and others, it is signified by \r.
Because of variances in operating languages and the codes they use, text files are not always compatible between operating systems. For example, Macintosh uses the code CR to indicate the end of each line, similar to the typewriter. With Linux, each line ends with LF, which indicates line feed. These codes not only differ in lettering; their ASCII codes are different as well — CR is a 13 in ASCII code and LR is a 10. With Microsoft products, lines end with a combination of both: CRLF.

Fortunately, most people can use File Transfer Protocol (FTP) to transfer text files from one operating system to another. To transfer text files, users should choose the ASCII mode of FTP. To transfer other types of files, such as photos or sound files, they should use FTP in the binary mode.
AS FEATURED ON:
AS FEATURED ON:









Discussion Comments
"Cr is a 13 in ascii code and lr is a 10"
lr -> lf
@GoldenRatio - Good question! There are many situations where you will not be able to input a carriage return with the enter key because pressing the enter key will result in another action.
In windows, to enter a carriage return using ASCII, hold down the ALT key and hit the key sequence ‘0’ ‘1’ ‘3.’ When you release the alt key, a carriage return will be inserted.
I’m *pretty* sure it works the same way on OSX and linux.
Good article. This article mentions the ASCII code for a carriage return… can anybody tell me how I would input a carriage return by using the ASCII code and not the enter key?
Post your comments