Re: [Alephmodular-devel] Random rumblings on files and errors
Status: Pre-Alpha
Brought to you by:
brefin
From: Br'fin <br...@ma...> - 2003-01-30 12:29:12
|
On Thursday, January 30, 2003, at 06:46 AM, Michael Adams wrote: > > --- Dietrich Epp <die...@zd...> wrote: >> >> Is there really a difference between text and binary >> mode? I thought >> that was all arcane. I've never liked C++ >> iostreams, they have only >> served to add compile time and code size in the >> megabytes to my projects. > > Yes, there is a difference. I've had files > incorrectly read when the wrong one is used. Just > like ASCII vs. Binary FTP it can become a problem when > newlines are converted. This happens on at leat Win32 > because a \n in code becomes a \r\n in the file and > vise versa. I've seen quite a few bugs happen that > way. > On unix and Mac systems the bit of text vs binary is generally arcane. They may use different line endings, but they don't process that character on input/output. Oddly enough, the most common system, Windows, is the one that has a problem with it. Unless you specify a file to be binary when opening it, then there is a chance of having all your \n mishandled. (Expanding to \r\n when writing out, or munged together when reading in) -Jeremy Parsons |