seek 671 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. .TH SEEK 2
  2. .SH NAME
  3. seek \- change file offset
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .B
  10. vlong seek(int fd, vlong n, int type)
  11. .SH DESCRIPTION
  12. .I Seek
  13. sets the offset for the file
  14. associated with
  15. .I fd
  16. as follows:
  17. .IP
  18. If
  19. .I type
  20. is 0, the offset is set to
  21. .I n
  22. bytes.
  23. .IP
  24. If
  25. .I type
  26. is 1, the pointer is set to its current location plus
  27. .IR n .
  28. .IP
  29. If
  30. .I type
  31. is 2, the pointer is set to the size of the
  32. file plus
  33. .IR n .
  34. .PP
  35. The new file offset value is returned.
  36. .PP
  37. Seeking in a directory is not allowed.
  38. Seeking in a pipe is a no-op.
  39. .SH SOURCE
  40. .B /sys/src/libc/9syscall
  41. .SH SEE ALSO
  42. .IR intro (2),
  43. .IR open (2)
  44. .SH DIAGNOSTICS
  45. Sets
  46. .IR errstr .