This is the mail archive of the cygwin@sourceware.cygnus.com
mailing list for the Cygwin project. See the Cygwin
home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]
Re: Cygwin B20 - fseek under gcc fails to reposition on text files
- To: cgf@cygnus.com
- Subject: Re: Cygwin B20 - fseek under gcc fails to reposition on text files
- From: DJ Delorie <dj@delorie.com>
- Date: Tue, 16 Feb 1999 21:17:45 -0500
- CC: earnie_boyd@yahoo.com, kabal@ece.mcgill.ca, cygwin@sourceware.cygnus.com
- Delivered-To: listarch-cygwin@sourceware.cygnus.com
- Delivered-To: mailing list cygwin@sourceware.cygnus.com
- In-reply-to: <19990216205243.L16511@cygnus.com> (message from ChristopherFaylor on Tue, 16 Feb 1999 20:52:43 -0500)
- Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
- References: <19990216154134.3413.rocketmail@send104.yahoomail.com> <19990216205243.L16511@cygnus.com>
- Sender: cygwin-owner@sourceware.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.