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.
chmod
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The chmod function changes the permission setting of the file
specified by <filename>. The permission setting controls read and
write access to the file.
The constant expression <pmode> contains one or both of the
manifest constants S_IWRITE and S_IREAD, defined in SYS\STAT.H.
Any other values for <pmode> are ignored. When both constants are
given, they are joined with the bitwise-OR operator (|). The
meaning of the <pmode> argument is determined by either the
S_IWRITE or S_IREAD manifest constant.
If write permission is not given, the file is read-only. Under
MS-DOS and OS/2, all files are readable; it is not possible
to give write-only permission. Thus the modes S_IWRITE and
S_IREAD | S_IWRITE are equivalent.
Return Value
The chmod function returns the value 0 if the permission setting
is successfully changed. A return value of -1 indicates an error;
in this case, errno is set to ENOENT, indicating that the
specified file could not be found.
-♦-