Difference between text mode and binary mode in c
c, file-io
Solution
In a sense, binary mode is "raw": nothing is translated, since it has no basis for doing so. Whereas in text mode, the file is interpreted as text, and thus (for example) line endings get translated to the appropriate representation.
Problem
while writing/reading of file in text mode, the new line character is translated in to carriage return and linefeed i.e \n to \r\n but in binary mode this doesn't happen. Similarly, the ASCII value 26 will be written at the end of file in text mode but this doesn't happen in binary mode. I know this question was asked earlier in SO but there i didn't find any reasoning for this behavior. I mean, is this behavior is just to differentiate the text and binary mode or is there any specific reason of this translation and not writing ASCII value 26 in case of binary mode.