Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telix/SALT v3.15 & RS-232, Hayes - <b>fileattr</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  FILEATTR

  .  Summary

  fileattr(str <filespec>);

  .  Description

  Under the MS-DOS file system, files have a certain attributes which
  can determine their functions or the way certain things behave. For
  example if a file has the 'hidden' bit set as part of its attribute
  byte, when you do a DOS dir command, the file is not shown. Simi-
  larly, if a file has the read only bit set, you may not overwrite
  it.

  The fileattr function returns an integer value representing the at-
  tributes of a specified file. <filespec> is the name of the file and
  may include a drive and directory portion, as well as the DOS wild-
  card characters * and ?.

  The value returned is a total of the following attributes.

       1    Read only file.

       2    Hidden file. The file is not listed when the DOS dir com-
            mand is executed.

       4    System file. The file is not listed when the DOS dir com-
            mand is executed.

       8    Volume label. This is the volume name of the disk.

       16   Subdirectory. This is a subdirectory name.

       32   Archive bit. This is set by DOS whenever a file has been
            written to and is then used by some backup software to
            check if a file has been modified since last backed-up.

  Each of these values is a certain bit in a byte. To test for the ex-
  istence of an attribute, the bitwise AND operator should be used.
  For example, the following fragment would check if the read only bit
  in an attribute is set:

       if (attrib & 1)
        ...

  If <filespec> is blank (""), then the attributes of the last file
  found with the filefind function is returned. Note that calling
  filesize or filetime in the meantime with a non-blank filename would
  instead make this call return the attributes of files found with
  those functions, as they use the same buffer.

  .  Return Value

  An integer value representing the combined attributes of the in-
  dicated file is returned, or a value of -1 is returned if the in-
  dicated file could not be found.

  .  Example

  int attr;
  str filename[64];
  gets(filename, 64);
  attr = fileattr(filename);
  if (attr & 6)      // system _and_ hidden added together
   prints("This file is marked as hidden and system");

See Also: filefind filesize filetime

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