octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file offsets used by fseek and ftell


From: John W. Eaton
Subject: Re: file offsets used by fseek and ftell
Date: Fri, 23 Jan 2004 14:44:22 -0600

On 23-Jan-2004, Alois Schloegl <address@hidden> wrote:

| I'm afraid, I do not understand what you mean. .

I'd suggest looking at the C99 standard and/or rationale for the C99
standard WRT fseek, ftell, fsetpos, and fgetpos.

FWIW, it explains that

  ftell returns a "file position indicator", which has no necessary
  interpretation except that an fseek operation with that indicator
  value will position the file to the same place.  Thus an
  implementation may encode whatever file positioning information is
  most appropriate for a text file, subject only to the constraint
  that the encoding be representable as a long.

Note that it does *not* say that the value returned from ftell is the
"number of bytes from the beginning of the file".  It could use some
of the bits in a long to store a record number and the rest for the
position in the record.  There would not even have to be any simple
way to use that information to compute the number of bytes from the
beginning of the file (for example, you might have to look to see how
much data each record contains).

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]