Later, in the age of modern teleprinters, standardized character set control codes were developed to aid in white space text formatting.
"[2] In fact, it was often necessary to send extra padding characters—extraneous CRs or NULs—which are ignored but give the print head time to move to the left margin.
From there MS-DOS (1981) adopted CP/M's CR+LF in order to be compatible, and this convention was inherited by Microsoft's later Windows operating system.
What seems like a more obvious choice—CR—was not used, as CR provided the useful function of overprinting one line with another to create boldface, underscore and strikethrough effects.
The concepts of carriage return (CR) and line feed (LF) are closely associated and can be considered either separately or together.
In the physical media of typewriters and printers, two axes of motion, "down" and "across", are needed to create a new line on the page.
Although the design of a machine (typewriter or printer) must consider them separately, the abstract logic of software can combine them together as one event.
This is why a newline in character encoding can be defined as CR and LF combined into one (commonly called CR+LF or CRLF).
In particular, protocols published by the Internet Engineering Task Force (IETF) typically use the ASCII CRLF sequence.
For example: Unicode includes some glyphs intended for presenting a user-visible character to the reader of the document, and are thus not recognized themselves as a newline: To facilitate creating portable programs, programming languages provide some abstractions to deal with the different types of newline sequences used in different environments.
The C standard only guarantees two traits: On Unix operating system platforms, where C originated, the native newline sequence is ASCII LF (0x0A), so \n was simply defined to be that value.
This has caused many programmers who developed their software on Unix systems simply to ignore the distinction completely, resulting in code that is not portable to different platforms.
The C standard library function fgets() is best avoided in binary mode because any file not written with the Unix newline convention will be misread.
Many languages, such as C++, Perl,[17] and Haskell provide the same interpretation of \n as C. C++ has an alternative input/output (I/O) model where the manipulator std::endl can be used to output a newline (and flushes the stream buffer).
The Java Class Library input/output (I/O) methods do not transparently translate these into platform-dependent newline sequences on input or output.
For example, a compiler may fail with obscure syntax errors even though the source file looks correct when displayed on the console or in an editor.
Modern text editors generally recognize all flavours of CR+LF newlines and allow users to convert between the different standards.
[22] The standard Internet Message Format[23] for email states: "CR and LF MUST only occur together as CRLF; they MUST NOT appear independently in the body".
[26] The tr command is available on virtually every Unix-like system and can be used to perform arbitrary replacement operations on single characters.
In text intended primarily to be read by humans using software which implements the word wrap feature, a newline character typically only needs to be stored if a line break is required independent of whether the next word would fit on the same line, such as between paragraphs and in vertical lists.