Date: Sat, 3 May 1997 17:49:21 +0800 (GMT) From: Orlando Andico To: Ethan Rohrer cc: djgpp AT delorie DOT com Subject: Re: help: read()ing from files containing 0x1A In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Fri, 2 May 1997, Ethan Rohrer wrote: > > Hello all, > > I am trying to port some code from my UNIX account to my DOS machine. > My program reads a binary file using a open()/read()/close() sequence. > It worked like a champ in my UNIX account. > > Now, under DJGPP, I find that read() stops reading when it encounters > the EOF character (0x1A), which just happens to occur every here and > there in my binary files... In your open() call, add O_BINARY to the flags. Note that this is nonportable to UNIX, so you do something like: #include #include #include #ifdef MSDOS i = open ("myfile", O_RDWR | O_BINARY); #else i = open ("myfile", O_RDWR); #endif ----------------------------------------------------------------------- Orlando Alcantara Andico WWW: http://www2.mozcom.com/~orly/ Email: orly AT mozcom DOT com ICBM: 14 deg. 30' N, 120 deg. 59' E POTS: (+632) 932-2385