Go to the first, previous, next, last section, table of contents.


chmod

Syntax

#include <sys/stat.h>

int chmod(const char *path, mode_t mode);

Description

This function changes the mode (writable or write-only) of the specified file. The value of mode can be a combination of one or more of the following:

S_IRUSR
Make the file readable
S_IWUSR
Make the file writable

Other S_I* values could be included, but they will be ignored.

Return Value

Zero if the file exists and the mode was changed, else nonzero.

Portability

not ANSI, POSIX

Example

chmod("/tmp/dj.dat", S_IWUSR|S_IRUSR);


Go to the first, previous, next, last section, table of contents.