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>_dos_setfileattr() set file or directory attributes</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _dos_setfileattr()      Set file or directory attributes

 #include   <dos.h>

  unsigned     _dos_setfileattr(path, attribute);
  char *path;  File name and path
  unsigned *attribute;   New attributes

    _dos_setfileattr() uses MS-DOS function 43h to set the attributes of
    the file or directory specified by 'path'. The new attribute values
    are placed in the low-order byte of 'attribute', represented by the
    following manifest constants:

                    Constant     Meaning
                    ------------------------------------------------
                    _A_NORMAL    Normal file, can be read and written to.
                    _A_RDONLY    Read only file
                    _A_HIDDEN    Hidden file
                    _A_SYSTEM    System file
                    _A_VOLID     Volume ID
                    _A_SUBDIR    Subdirectory
                    _A_ARCH      Archive, file changed since last backup

    Returns:    _dos_setfileattr() returns 0 if successful. If
                unsuccessful it returns the MS-DOS error code and sets
                errno to one of the following:

                    Constant      Meaning
                    --------------------------------
                    ENOENT    The file or directory could not be found.
                    EACCES    Access denied (cannot change volume ID or
                              subdirectory)

   Portability:     MS-DOS only, version 2.0 or higher

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

 This program sets the attributes of the file "test.c" to read only, hidden

           #include <dos.h>

           main()
           {
              unsigned attribute;
              unsigned return_val;

              return_val = _dos_setfileattr( "test.c", _A_RDONLY | _A_HIDDEN
           );
              if (return_val)
                 printf("File \"test.c\" not found\n");
           }


See Also: _dos_getfileattr()

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