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 6.0 - <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:   Read only; writing is not allowed.
            S_IREAD:    Write only; reading is not allowed.

    The permission setting for a new file is set when the file is closed
    for the first time.  Bits set to "1" in this mask will cause the
    corresponding bit in the file's requested permission value to be set
    to zero (disallowed).

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

      Notes:    Setting the S_IREAD bit with umask() under MS-DOS has no
                effect--all files are readable.

 Portability:   Not supported by ANSI standard.

   -------------------------------- 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