Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>setfattr()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SETFATTR()
 Sets a file's attributes
------------------------------------------------------------------------------
 Syntax

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

 Arguments

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

 Returns

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

 Description

     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.

 Notes

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

 Examples

     .  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
           *...
        ENDIF


See Also: FILESEEK() FILEATTR() BITTOC() CTOBIT()

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