home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man2 / read.2 < prev    next >
Encoding:
Text File  |  1975-06-26  |  1.1 KB  |  55 lines

  1. .th READ II 8/5/73
  2. .sh NAME
  3. read \*- read from file
  4. .sh SYNOPSIS
  5. (read = 3.)
  6. .br
  7. (file descriptor in r0)
  8. .ft B
  9. .br
  10. sys read; buffer; nbytes
  11. .br
  12. .s3
  13. read(fildes, buffer, nbytes)
  14. .br
  15. char *buffer;
  16. .ft R
  17. .sh DESCRIPTION
  18. A file descriptor is a word
  19. returned from a successful
  20. .it "open, creat, dup,"
  21. or
  22. .it pipe
  23. call.
  24. .it Buffer
  25. is the location of
  26. .it nbytes
  27. contiguous
  28. bytes into which the input will be placed.
  29. It is not guaranteed
  30. that all
  31. .it nbytes
  32. bytes will be read; for example
  33. if the file refers to a typewriter at most one line
  34. will be returned.
  35. In any event the number of characters read is returned
  36. (in r0).
  37. .s3
  38. If the returned value is 0, then
  39. end-of-file has been reached.
  40. .sh "SEE ALSO"
  41. open (II), creat (II), dup (II), pipe (II)
  42. .sh DIAGNOSTICS
  43. As mentioned,
  44. 0 is returned when the end of the file has been reached.
  45. If the read was otherwise unsuccessful
  46. the error bit (c-bit) is set.
  47. Many conditions
  48. can generate an error:
  49. physical I/O errors, bad buffer address,
  50. preposterous
  51. .it nbytes,
  52. file descriptor not that of
  53. an input file.
  54. From C, a \*-1 return indicates the error.
  55.