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

  1. .th CREAT II 8/5/73
  2. .sh NAME
  3. creat  \*-  create a new file
  4. .sh SYNOPSIS
  5. (creat = 8.)
  6. .br
  7. .ft B
  8. sys creat; name; mode
  9. .br
  10. .ft R
  11. (file descriptor in r0)
  12. .ft B
  13. .s3
  14. creat(name, mode)
  15. .br
  16. char *name;
  17. .ft R
  18. .sh DESCRIPTION
  19. .it Creat
  20. creates a new file or prepares to rewrite an existing
  21. file called 
  22. .it name,
  23. given as the address of a null-terminated string.
  24. If the file did not exist, it is given
  25. mode
  26. .it mode.
  27. See
  28. .it chmod
  29. (II) for the
  30. construction of the
  31. .it mode
  32. argument.
  33. .s3
  34. If the file did exist, its mode and owner remain unchanged
  35. but it is truncated to 0 length.
  36. .s3
  37. The file is also opened for writing, and its file descriptor
  38. is returned (in r0).
  39. .s3
  40. The
  41. .it mode
  42. given is arbitrary; it need not allow
  43. writing.
  44. This feature is used by programs which deal with temporary
  45. files of fixed names.
  46. The creation is done with
  47. a mode that forbids writing.
  48. Then if a second
  49. instance of the program attempts a
  50. .it creat,
  51. an error is
  52. returned and the program knows that the name is unusable
  53. for the moment.
  54. .sh "SEE ALSO"
  55. write (II), close (II), stat (II)
  56. .sh DIAGNOSTICS
  57. The error bit
  58. (c-bit) may be set if: a needed directory is not searchable;
  59. the file does not exist and the directory
  60. in which it is to be created is not writable; the file
  61. does exist and is unwritable;
  62. the file is a directory;
  63. there are already too many files open.
  64. .s3
  65. From C, a \*-1 return indicates an error.
  66.