From octave-maintainers-request at bevo dot che dot wisc dot edu Fri Jan 23 14:45:13 2004 Subject: Re: file offsets used by fseek and ftell From: "John W. Eaton" To: Alois Schloegl Cc: octave-maintainers at bevo dot che dot wisc dot edu, bug-octave@bevo.che.wisc.edu Date: Fri, 23 Jan 2004 14:44:22 -0600 On 23-Jan-2004, Alois Schloegl 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