Reads a portion of a file into a string


      FileStr(<cFile>, [<nLength>], [<nOffset>],
             [<lCtrl-Z>]) --> <cCharacterstring>


<cFile> : Designates the file from which a string is read.

<nLength> : Designates how many characters you want to read from a file. The default is read all characters.

<nOffset> : Designates an offset within the file from which the

<nLength> : characters or the rest of the file, are read. The default is from the first character (0).

<lCtrl-Z> : If this parameter is designated as .T., only data up to the first Ctrl-Z is read in. The default is read all data (.F.).


<cCharacterstring> : the string read in from the designated file.


FileStr() also offers the capability to read files or a portion of them, into a string. This is only possible with a function call, where the file name may contain a drive and path designation. If you implement the <lCtrl-Z> parameter, you can be sure the function only reads data up to the first Ctrl-Z and ignores whatever might remains in of the file.

In contrast to the Fxxxx() functions, a disadvantage of FileStr() is a slower access speed, since the file you want to read cannot be held open.


      .  Read in a file completely:

         ? FileStr("C:\TEXT\TEST.TXT")            // Displays file text

      .  Read in everything to the first Ctrl-Z:

         cVar  := FileStr("C:\TEXT\TEST.TXT", .T.)

      .  The file TEST.TXT contains "ABCDEFGHIJ".  Four characters,
         beginning from position 3, are to be read:

         ? FileStr("C:\TEXT\TEST.TXT", 4, 3)      // "CDEF"

      .  Read the maximum that fits into the available working memory:

         cVar  := FileStr("C:\TEXT\TEST.TXT", MEMORY(1) *1024 -100)




 Writes a string to a file


     STRFILE(<cCharacterstring>, <cFile>, [<lOverwrite>],
        [<nOffset>], [<lCutOff>]) --> nRecordedByte


     <cCharacterstring>  Designates the character string to write to a

     <cFile>  Designates a file name.  Drive and path designations are
     permitted, but no wildcards.

     <lOverwrite>  If not designated or designated as .F., determines
     whether or not a new file is created.  When .T., it writes to an
     existing file.  The default is create new file (.F.).

     <nOffset>  Designates an offset within the file from which the
     <cCharacterstring> string is to be written.  The default is End of file.

     <lCutOff>  When this optional parameter is designated as .T., the
     function truncates the file if data written ends before the last file
     byte.  The default is no cut off (.F.).


     STRFILE() returns the actual number of bytes written.


     This function provides another capability besides writing the contents
     of a string to a file.  In contrast to the Clipper Fxxxx() functions,
     only one function call is necessary to write data to a file.  However,
     it can result in some speed disadvantages, since files acted on by
     STRFILE() cannot be held open.

     If the target file is unavailable, the STRFILE() function always creates


     .  The attribute to create a new file, can be designated with the
        SETFCREATE() function.

     .  As recommended with the share mode, reads and writes from
        other network programs should be locked out with SETSHARE() for this
        period of time.

     .  This function acknowledges the setting for CSETSAFETY().


     .  Add to the end of a file:

        ? STRFILE("ABCDEFGH", "TEST.TXT", .T.)             // Result: 8

     .  A file with drive and path designations, result: 10:

        ? STRFILE("0123456789", "C:\TEXT\TEST.TXT", .T.)

     .  Data in an existing file is overwritten from position 20 with
        a designated string:

        ? STRFILE("NANTUCKET", "TEST.TXT", .T., 20)        // Result: 9

     .  A 5-character string is written starting at position 10 in an
        existing file 20-characters long.  Since the final parameter is
        specified as .T. once, and specified as .F. once, you see different

        ? STRFILE(REPLICATE("X", 20), "TEST.TXT")
        ? STRFILE("AAAAA", "TEST.TXT", .T., 10, .T  // "XXXXXXXXXXAAAAA"



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