Date: Mon, 2 Feb 1998 19:05:11 +0200 (IST) From: Eli Zaretskii To: Noam Rotem cc: djgpp AT delorie DOT com Subject: Re: Text / binary implementation differences In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Sun, 1 Feb 1998, Noam Rotem wrote: > What is the difference, from the implementation side, between a text > file and a binary one? It depends on the implementation. Some of them, like a program which copies files, don't care; others do. You will have to tell more to get meaningful answers. In general, only programs which depend on the fact that lines end with the `\n' character need to care about the difference (since DOS text files usually end lines with the \r\n pair. For clarity, you should also talk about binary vs text I/O, not binary vs text files, as DOS itself and its filesystem in particular don't care about the distinction. > Does djgpp mark EOF differently in a text file and a binary file? DJGPP doesn't mark the EOF at all. The Ctrl-Z character is treated as a kind of ``software EOF'' in text I/O, but DJGPP doesn't write this character at end of files. > Is there any difference in the way the stream is buffered or > treated? No difference as far as buffering is concerned. The only difference in the treatment part is that \r characters are removed when reading text files and added after each \n when writing them. > And, BTW, are stdin / stdout *text* streams? By default, *all* streams are open in text mode, unless you explicitly say otherwise, either in the `fopen'/`open' call or by setting the global variable `_fmode' to O_BINARY. > (I understand the logical differences between the two kinds, but not > the actual compiler job around each one). The compiler doesn't do anything with this. It is the job of the library.