Sets a file's attributes


     SETFATTR(<cFile>, <nFileAttr>) --> nErrorCode


     <cFile>  Designates the file that has attributes you want to change.
     Drive and path designations are allowed, but no wildcards.

     <nFileAttr>  Designates the new attributes in numeric form.  The
     default is 32 (ARCHIVE).


     SETFATTR() returns the attribute implemented to the designated file or a
     negative value as an error code.  The codes are explained below:

     Table 7-20:  SETFATTR() Error Codes
     Code    Symb. constants     Definition
      0      NO_DISK_ERR         No error found
     -2      ER_FILE_NOT_FOUND   File not found
     -3      ER_PATH_NOT_FOUND   Path not found
     -5      ER_ACCESS_DENIED    Access denied (e.g., in network)


     This function permits you to change a file attribute.  The attributes
     are represented as a numeric value and explained in the table below:

     Table 7-21:  Coding the File Attribute
     Value   Symb. constants     Assigned attribute
     0       FA_NORMAL
     1       FA_READONLY         READ ONLY (Read-only)
     2       FA_HIDDEN           HIDDEN (Hidden files)
     4       FA_SYSTEM           SYSTEM (System files)
     32      FA_ARCHIVE          ARCHIVE (Changes since last backup)

     If you implement multiple attributes for a file, you must also add the
     individual values.


     .  Use the VOLUME() function to create volume labels and
        directories through the DIRMAKE() function.  Additional attributes
        can also be set at directory level.

     .  The BITTOC() and CTOBIT() functions can prove helpful in
        conjunction with the file attributes.

     .  An attempt to set (.AND...) attributes at pseudo files can
        trigger a system crash.


     .  Set a file to HIDDEN:

        ? SETFATTR("TEST.TXT", 2)       // Returns 0, if successful

     .  When a file is not available:

        ? SETFATTR("ABCDEFGH"), 2)      // Returns: -2

     .  Influence the return value:

        nAttribute  := SETFATTR("TEST.TXT", 7)
        IF nAttribute <> 7



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.