Carriage return

From WikiMD's Medical Encyclopedia

File:Underwoodfive.jpg
Underwoodfive

Carriage Return (CR) is a control character in computing used to reset a device's position to the beginning of a line of text. Originating from the mechanical actions of typewriters, where the carriage holding the paper would return to its initial position after reaching the end of a line, the concept has been adapted into the digital realm. It is represented by the ASCII code 13 (0x0D in hexadecimal) and is often seen in combination with the Line Feed (LF) character in text files to denote the end of a line, especially in the context of Windows operating systems.

Usage[edit]

In the early days of computing, the carriage return was used in conjunction with the line feed character to prepare a printer or a screen for the next line of text. The CR would return the cursor to the beginning of the line, and the LF would advance the output to the next line. This combination is still used in modern operating systems like Windows, where the end of a line is marked by both CR and LF characters (CRLF). In contrast, Unix and Unix-like systems such as Linux and macOS use only the LF character to denote the end of a line, while older Macintosh systems used solely the CR character.

Programming and Data Formats[edit]

In programming languages, the carriage return character is often used within strings to represent the end of a line. For example, in C and languages that follow C syntax, such as C++, Java, and JavaScript, '\r' represents the CR character. Its usage varies depending on the operating system's convention for line endings in text files.

In data formats, especially in text-based formats like CSV (Comma-Separated Values), the CR character can be used to signify the end of a line, although the convention may vary depending on the system handling the data.

Historical Context[edit]

The carriage return's origins can be traced back to typewriters and teleprinters, where physically moving the carriage or print head back to the start of the line was necessary to continue typing or printing characters on a new line. As technology evolved, the concept was incorporated into computer terminals and printers, maintaining the metaphor of the carriage's movement.

Modern Relevance[edit]

While the physical action of returning a carriage is no longer necessary in digital devices, the carriage return character remains a fundamental part of text processing and data representation in computing. Its significance is particularly noted in the context of cross-platform software development, where understanding the differences in line-ending conventions is crucial for ensuring compatibility and proper data interpretation across different operating systems.

See Also[edit]


Stub icon
   This article is a computing stub. You can help WikiMD by expanding it!



Navigation: Wellness - Encyclopedia - Health topics - Disease Index‏‎ - Drugs - World Directory - Gray's Anatomy - Keto diet - Recipes


Ad. Transform your life with W8MD's

GLP-1 weight loss injections special from $29.99 with insurance

Advertise on WikiMD


WikiMD Medical Encyclopedia

Medical Disclaimer: WikiMD is for informational purposes only and is not a substitute for professional medical advice. Content may be inaccurate or outdated and should not be used for diagnosis or treatment. Always consult your healthcare provider for medical decisions. Verify information with trusted sources such as CDC.gov and NIH.gov. By using this site, you agree that WikiMD is not liable for any outcomes related to its content. See full disclaimer.
Credits:Most images are courtesy of Wikimedia commons, and templates, categories Wikipedia, licensed under CC BY SA or similar.