Flashnux

GNU/Linux man pages

Livre :
Expressions régulières,
Syntaxe et mise en oeuvre :

ISBN : 978-2-7460-9712-4
EAN : 9782746097124
(Editions ENI)

Unix

Unix v6

creat(2)



creat create a new file (creat = 8.)
sys creat; name; mode

(file descriptor in r0) creat(name, mode)
char *name;
creates a new file or prepares to rewrite an existing file called given as the address of a null-terminated string. If the file did not exist, it is given mode See (II) for the construction of the argument. If the file did exist, its mode and owner remain unchanged but it is truncated to 0 length. The file is also opened for writing, and its file descriptor is returned (in r0). The given is arbitrary; it need not allow writing. This feature is used by programs which deal with temporary files of fixed names. The creation is done with a mode that forbids writing. Then if a second instance of the program attempts a an error is returned and the program knows that the name is unusable for the moment. write (II), close (II), stat (II) The error bit (c-bit) may be set if: a needed directory is not searchable; the file does not exist and the directory in which it is to be created is not writable; the file does exist and is unwritable; the file is a directory; there are already too many files open. From C, a 1 return indicates an error.



creat(2)