a couple of random questions

Doug Gwyn gwyn at brl-smoke.ARPA
Sat Apr 16 14:40:41 AEST 1988


In article <541 at vsi.UUCP> friedl at vsi.UUCP (Stephen J. Friedl) writes:
>I believe that dpANS does not address lseek(2) because it is an
>operating system function; they specify fseek(3) instead, where
>the offset is defined to be in characters.  Presumably the stdio
>library is required to "just figure it out" on a record-based
>system.  I've seen it written somewhere that the only portable
>way to get an lseek(2) offset is as a result from a previous lseek(2).

lseek() is not in the dpANS for C because it refers to a file descriptor,
and no file-descriptor oriented functions are permitted in the dpANS.
POSIX (actually IEEE 1003.1) on the other hand intends to standardize
such functions.

lseek() works in bytes, using the UNIX file model (sequence of bytes).
fseek() to an absolute position only works PORTABLY if the cookie you
give it is one obtained from ftell().  rewind() will always do what
one would think.



More information about the Comp.lang.c mailing list