delorie.com/djgpp/doc/libc/libc_94.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 for the owner.

S_IWUSR

Make the file writable for the owner.

S_IRGRP

Make the file readable for the group.

S_IWGRP

Make the file writeable for the group.

S_IROTH

Make the file readable for the world.

S_IWOTH

Make the file writeable for the world.

Some S_I* constants are ignored for regular files:

This function can be hooked by File System Extensions (see section File System Extensions).

Return Value

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

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

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


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004