SEEK(2)                                                   SEEK(2)

     NAME
          seek - change file offset

     SYNOPSIS
          #include <u.h>
          #include <libc.h>

          vlong seek(int fd, vlong n, int type)

     DESCRIPTION
          Seek sets the offset for the file associated with fd as fol-
          lows:

               If type is 0, the offset is set to n bytes.

               If type is 1, the pointer is set to its current loca-
               tion plus n.

               If type is 2, the pointer is set to the size of the
               file plus n.

          The new file offset value is returned.

          Seeking in a directory is not allowed.  Seeking in a pipe is
          a no-op.

     SOURCE
          /sys/src/libc/9syscall

     SEE ALSO
          intro(2), open(2)

     DIAGNOSTICS
          Sets errstr.

     Page 1                       Plan 9            (printed 12/21/24)