Delivered-To: listarch-cygwin@sourceware.cygnus.com Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm Sender: cygwin-owner@sourceware.cygnus.com Delivered-To: mailing list cygwin@sourceware.cygnus.com Date: Tue, 16 Feb 1999 21:17:45 -0500 Message-Id: <199902170217.VAA11897@envy.delorie.com> From: DJ Delorie To: cgf@cygnus.com CC: earnie_boyd@yahoo.com, kabal@ece.mcgill.ca, cygwin@sourceware.cygnus.com In-reply-to: <19990216205243.L16511@cygnus.com> (message from Christopher Faylor on Tue, 16 Feb 1999 20:52:43 -0500) Subject: Re: Cygwin B20 - fseek under gcc fails to reposition on text files References: <19990216154134.3413.rocketmail@send104.yahoomail.com> <19990216205243.L16511@cygnus.com> > >* Seeking with an offset of 0 relative to any of the origin values. This means fseek(file, 0, SEEK_SET) or fseek(file, 0, SEEK_END). > >* Seeking from the beginning of the file with an offset value returned > >from a call to ftell. This allows the library to read() through the file instead of seeking, to compensage for CR/LF conversions. If you seek from the end of the file, these rules do not guarantee success. The problems are usually in ftell(), since with buffered I/O it's nearly impossible to determine what actual file position corresponds to a character in the middle of a stdio buffer. DJGPP could only solve this problem by having stdio open *all* files as binary, and managing the conversion after the buffering.