Windows next car and line break
Data entered from the keyboard is generally ASCII code, which is a text file, when sent to the computer memory, carriage return and newline characters into a newline character (that is, the carriage return and newline characters in the Windows text is two character), and then from memory in the "WB" mode (binary) output to a file, Character conversions do not occur, output to disk files as-is in memory, and when read in "RB" mode (binary), the data is entered as-is, no character conversion occurs, and is read directly into memory, and when characters are displayed on the screen with the printf function, The newline character is converted to carriage return plus a newline character.
If you read the data in "R" mode (text), the data will go wrong because the line break will be converted again when it is displayed.
Windows next car and line break