delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/02/17/02:18:02

Delivered-To: listarch-cygwin AT sourceware DOT cygnus DOT com
Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Date: Tue, 16 Feb 1999 21:17:45 -0500
Message-Id: <199902170217.VAA11897@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: cgf AT cygnus DOT com
CC: earnie_boyd AT yahoo DOT com, kabal AT ece DOT mcgill DOT ca, cygwin AT sourceware DOT cygnus DOT 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 DOT 3413 DOT rocketmail AT send104 DOT yahoomail DOT com> <19990216205243 DOT L16511 AT cygnus DOT 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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019