creat.2

来自「unix v7是最后一个广泛发布的研究型UNIX版本」· 2 代码 · 共 62 行

2
62
字号
.TH CREAT 2 .SH NAMEcreat  \-  create a new file.SH SYNOPSIS.B creat(name, mode).br.B char *name;.SH DESCRIPTION.I Creatcreates a new file or prepares to rewrite an existingfile called .I name,given as the address of a null-terminated string.If the file did not exist, it is givenmode.IR mode ,as modified by the process's mode mask (see.IR umask (2)).Also see.IR  chmod (2)for theconstruction of the.I modeargument..PPIf the file did exist, its mode and owner remain unchangedbut it is truncated to 0 length..PPThe file is also opened for writing, and its file descriptoris returned..PPThe.I modegiven is arbitrary; it need not allowwriting.This feature is used by programs which deal with temporaryfiles of fixed names.The creation is done witha mode that forbids writing.Then if a secondinstance of the program attempts a.I creat,an error isreturned and the program knows that the name is unusablefor the moment..SH "SEE ALSO"write(2), close(2), chmod(2), umask (2).SH DIAGNOSTICSThe value \-1 is returned if:a needed directory is not searchable;the file does not exist and the directoryin which it is to be created is not writable; the filedoes exist and is unwritable;the file is a directory;there are already too many files open..SH ASSEMBLER(creat = 8.).br.B sys creat; name; mode.br(file descriptor in r0)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?