Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>chmod</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
chmod

Usage


   #include <io.h>
   #include <sys\stat.h>
   int chmod (char *pathname, int pmode);

Description

   chmod is used to change the permission on a file specified by pathname to
   permissions pmode. The user must have write permission for the file. The
   following values are valid for pmode:

           S_IREAD         read
           S_IWRITE        write

   Note that write permission implies that files may be deleted.

Example 

   #include <io.h>
   #include <sys\stat.h>

   #include <stdlib.h>

   char *pathname = "\temp"

   int main()
   {
       int result;
       result=chmod (pathname, S_IREAD|S_IWRITE|S_EXECUTE);
       if (result !=0) {
           printf ("Can't change permissions on file %s\n",pathname);
           return EXIT_FAILURE;
       } else
           printf ("Permissions changed on file %s\n",pathname);
       return EXIT_SUCCESS;
   }

Return Value

   Returns 0 upon success, otherwise -1 and errno is set.

See Also

   mknod





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson