文件权限常量File Permission Constants

语法Syntax


#include <sys/stat.h>  

备注Remarks

当指定 _O_CREAT_open_sopen)时需要这些常量中的一个。One of these constants is required when _O_CREAT (_open, _sopen) is specified.

pmode 参数按以下方式指定文件的权限设置。The pmode argument specifies the file's permission settings as follows.

常量Constant 含义Meaning
_S_IREAD 允许读取Reading permitted
_S_IWRITE 允许写入Writing permitted
_S_IREAD | _S_IWRITE_S_IREAD | _S_IWRITE 允许读取和写入。Reading and writing permitted

当用作 pmode_umask 参数时,清单常量将设置权限设置,如下所示。When used as the pmode argument for _umask, the manifest constant sets the permission setting, as follows.

常量Constant 含义Meaning
_S_IREAD 不允许写入(文件是只读的)Writing not permitted (file is read-only)
_S_IWRITE 不允许读取(文件是只写的)Reading not permitted (file is write-only)
_S_IREAD | _S_IWRITE_S_IREAD | _S_IWRITE 既不允许读取也不允许写入Neither reading nor writing permitted

另请参阅See Also

_open、_wopen _open, _wopen
_sopen、_wsopen _sopen, _wsopen
_umask _umask
标准类型 Standard Types
全局常量Global Constants