man(1) Manual page archive


     FSEEK(3S)                                               FSEEK(3S)

     NAME
          fseek, ftell, rewind - reposition a stream

     SYNOPSIS
          #include <stdio.h>

          int fseek(stream, offset, ptrname)
          FILE *stream;
          long offset;

          long ftell(stream)
          FILE *stream;

          int rewind(stream)

     DESCRIPTION
          Fseek sets the position of the next input or output opera-
          tion on the stream. The new position is at the signed dis-
          tance offset bytes from the beginning, the current position,
          or the end of the file, as ptrname has the value 0, 1 or 2
          respectively.

          Ftell returns the current value of the file pointer for the
          file associated with the named stream.

          Rewind(stream) is equivalent to fseek(stream, 0L, 0).

     SEE ALSO
          lseek(2), stdio(3)

     DIAGNOSTICS
          Fseek returns -1 for improper seeks.  Ftell returns -1 if
          seeking is impossible.

     BUGS
          The interaction of fseek and ungetc(3) is undefined.