as the line separator
is not DOS
-specific. Up until Unix
, this was the standard
s that treated text file
s as string
s of byte
s (as opposed to, say, record
-based systems). For most ARPANET
and Internet protocol
s, the line separator is and always has been the two-character CR-LF sequence. When Unix
were introduced, they used a single character for newline
, for simplicity.
When the IBM PC and MS-DOS were introduced in the very early 80s, C and Unix were not yet the industry-dominating forces they would later become. It only made sense to have text files compatible with the major commercial operating systems. No one was writing programs for the PC in C: it was usually assembly, BASIC, or Pascal.
When C started being ported to non-Unix OSes, the incompatibility had to be bridged somehow. Thus C compilers for DOS and other OSes have two modes for files: binary and text. In text mode, "\n" was converted to "\r\n" before being written, and "\r\n" was converted to "\n" when read; thus a single byte could represent the newline in memory, yet the OS standard could be followed on-disk (and for terminal I/O).
There is no sense blaming either of Microsoft or IBM for the mistakes of others. They have made enough on their own.