Carriage return
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 | edit source]
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 | edit source]
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 | edit source]
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 | edit source]
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 | edit source]
Search WikiMD
Ad.Tired of being Overweight? Try W8MD's physician weight loss program.
Semaglutide (Ozempic / Wegovy and Tirzepatide (Mounjaro / Zepbound) available.
Advertise on WikiMD
WikiMD's Wellness Encyclopedia |
Let Food Be Thy Medicine Medicine Thy Food - Hippocrates |
Translate this page: - East Asian
中文,
日本,
한국어,
South Asian
हिन्दी,
தமிழ்,
తెలుగు,
Urdu,
ಕನ್ನಡ,
Southeast Asian
Indonesian,
Vietnamese,
Thai,
မြန်မာဘာသာ,
বাংলা
European
español,
Deutsch,
français,
Greek,
português do Brasil,
polski,
română,
русский,
Nederlands,
norsk,
svenska,
suomi,
Italian
Middle Eastern & African
عربى,
Turkish,
Persian,
Hebrew,
Afrikaans,
isiZulu,
Kiswahili,
Other
Bulgarian,
Hungarian,
Czech,
Swedish,
മലയാളം,
मराठी,
ਪੰਜਾਬੀ,
ગુજરાતી,
Portuguese,
Ukrainian
Medical Disclaimer: WikiMD is not a substitute for professional medical advice. The information on WikiMD is provided as an information resource only, may be incorrect, outdated or misleading, and is not to be used or relied on for any diagnostic or treatment purposes. Please consult your health care provider before making any healthcare decisions or for guidance about a specific medical condition. WikiMD expressly disclaims responsibility, and shall have no liability, for any damages, loss, injury, or liability whatsoever suffered as a result of your reliance on the information contained in this site. By visiting this site you agree to the foregoing terms and conditions, which may from time to time be changed or supplemented by WikiMD. If you do not agree to the foregoing terms and conditions, you should not enter or use this site. See full disclaimer.
Credits:Most images are courtesy of Wikimedia commons, and templates Wikipedia, licensed under CC BY SA or similar.
Contributors: Prab R. Tumpati, MD