The flag binary configures the stream to suppress conversion of special characters or character sequences, such as end-of-line or end-of-file.
In OSs such as Windows or OS/2, a line end in text files is represented by 2 characters (CR and LF).
In normal text mode (ie, binary isn't set) newline characters are replaced by the 2-character sequence when reading and vice vera when writing, to avoid special processing.
•line feeds ('\n') will be translated to '\r\n" sequences on output
•carriage return/line feed sequences will be translated to line feeds on input.
|A text stream is an ordered sequence of characters composed into lines, each line|
consisting of zero or more characters plus a terminating new-line character. Whether the
last line requires a terminating new-line character is implementation-defined. Characters
may have to be added, altered, or deleted on input and output to conform to differing
conventions for representing text in the host environment. Thus, there need not be a one-
to-one correspondence between the characters in a stream and those in the external
representation. Data read in from a text stream will necessarily compare equal to the data
that were earlier written out to that stream only if: the data consist only of printing
characters and the control characters horizontal tab and new-line; no new-line character is
immediately preceded by space characters; and the last character is a new-line character.
Whether space characters that are written out immediately before a new-line character
appear when read in is implementation-defined. - C99