Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>umask() set default permission mask</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
umask()                  Set Default Permission Mask

 #include   <sys\types.h>
 #include   <sys\stat.h>
 #include   <io.h>                       Required for declarations only

 int        umask(pmode);
 int        pmode;                       Default permission setting

    umask() sets the default permission mask for any new files created in
    a program by creat(), open(), or sopen().  The argument 'pmode' is
    set to one of the following constants:

           S_IWRITE:   Writing is not allowed; file is read only.
           S_IREAD:    Reading is not allowed; file is write only.

    The permission setting for a new file is set when the file is closed
    for the first time.

    Returns:    The previous value of 'pmode'.  There is no error return.

      Notes:    Under MS-DOS, all files are readable.  Setting the read
                bit with umask() therefore has no effect.

  -------------------------------- Example ---------------------------------

    Example:  This example sets the mask so read-only files are created.

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

           int oldsetting;

           main()
           {
                 oldsetting = umask(S_IWRITE);
           }

See Also: chmod() creat() open()

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