Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
umask
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The umask function sets the file-permission mask of the current
process to the mode specified by <pmode>.
The file-permission mask is used to modify the permission setting
of new files created by creat, open, or sopen. If a bit in the
mask is 1, the corresponding bit in the file's requested
permission value is set to 0 (disallowed). If a bit in the mask is
0, the corresponding bit is left unchanged. The permission setting
for a new file is not set until the file is closed for the first
time.
The argument <pmode> is a constant expression containing one or
both of the manifest constants S_IWRITE and S_IREAD (defined in
SYS\STAT.H). When both constants are given, they are combined
with the bitwise-OR operator (|).
For example, if the write bit is set in the mask, any new files
are read-only.
Note that under DOS and OS/2, all files are readable──it is not
possible to give write-only permission. Therefore, setting the
read bit with umask has no effect on the file's modes.
Return Value
The umask function returns the previous value of <pmode>. There is
no error return.
-♦-