CT_SETFATTR

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

 

Tools — Disk Utilities

Introduction Disk Utilities
DELETEFILE() Deletes an error-tolerant file
DIRCHANGE()  Changes the current directory
DIRMAKE()    Creates a directory
DIRNAME()    Determines the name of the current directory
DIRREMOVE()  Removes a directory
DISKCHANGE() Changes the current disk drive
DISKCHECK()  Creates a checksum for a disk
DISKFORMAT() Formats disks, controlled through a UDF
DISKFREE()   Determines the space available on a floppy or hard disk
DISKNAME()   Determines the drive designator for the current drive
DISKREADY()  Tests to see if a disk drive is ready
DISKREADYW() Queries whether you can write to a drive
DISKSPEED()  Determines a comparison value for the drive speed
DISKSTAT()   Determines the status of a drive.
DISKTOTAL()  Determines the total capacity of a floppy or hard disk
DISKTYPE()   Determines the type of data carrier
DRIVETYPE()  Determines the drive type
FILEAPPEND() Appends data to a file
FILEATTR()   Determines a file's attributes
FILECCLOSE() Closes a file after backup mode
FILECCONT()  Copies sections of a file in backup mode
FILECDATI()  Determines which date the target file contains with FILECOPY()
FILECHECK()  Calculates/computes/determines a checksum for a file
FILECOPEN()  Tests to see if the file is still open in the backup mode
FILECOPY()   Copies files normally or in backup mode
FILEDATE()   Determines the file date
FILEDELETE() Deletes file(s) by name and attribute
FILEMOVE()   Moves files to another directory
FILESEEK()   Searches for files by name and attribute
FILESIZE()   Determines the size of a file
FILESTR()    Reads a portion of a file into a string
FILETIME()   Determines a file's time
FILEVALID()  Tests whether a string has a valid file name
FLOPPYTYPE() Determines the exact type of floppy drive
GETSHARE()   Determines the file open (share) mode
NUMDISKF()   Determines the number of installed disk drives
NUMDISKH()   Determines the number of hard disks
NUMDISKL()   Determines the number of available logical drives
RENAMEFILE() Fault tolerant renaming of a file.
RESTFSEEK()  Restores the FILESEEK environment
SAVEFSEEK()  Saves the current FILESEEK environment
SETFATTR()   Sets a file's attributes
SETFCREATE() Default attribute for creating with CA-Clipper Tools functions
SETFDATI()   Sets the date and time of a file
SETSHARE()   Sets default opening mode for CA-Clipper Tools file functions
STRFILE()    Writes a string to a file
TEMPFILE()   Creates a file for temporary use
TRUENAME()   Standardizes the path designation
VOLSERIAL()  Determines the DOS disk serial number
VOLUME()     Establishes a volume label for a floppy or hard disk