Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the difference between text and binary I/O?

binary text
0
Posted

Whats the difference between text and binary I/O?

0

In text mode, a file is assumed to consist of lines of printable characters (perhaps including tabs). The routines in the stdio library (getc, putc, and all the rest) translate between the underlying system’s end-of-line representation and the single \n used in C programs. C programs which simply read and write text therefore don’t have to worry about the underlying system’s newline conventions: when a C program writes a ‘\n’, the stdio library writes the appropriate end-of-line indication, and when the stdio library detects an end-of-line while reading, it returns a single ‘\n’ to the calling program. [footnote] In binary mode, on the other hand, bytes are read and written between the program and the file without any interpretation. (On MS-DOS systems, binary mode also turns off testing for control-Z as an in-band end-of-file character.) Text mode translations also affect the apparent size of a file as it’s read. Because the characters read from and written to a file in text mode do n

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123