CT_ERRORCODE

 ERRORCODE()
 Identifies a DOS error that has occurred previously
------------------------------------------------------------------------------
 Syntax

     ERRORCODE([<lKeep>]) --> nDosErrorCode

     Warning!  This function requires DOS 3.1 or higher.

 Argument

     <lKeep>  When this parameter is designated as .T., the function
     returns the internal error code memory value.

 Returns

     ERRORCODE() returns a value that represents the error code that occurred
     during the most-recently executed DOS function.

 Description

     If you do not specify a parameter or if the parameter is .F., then
     ERRORCODE() calls the DOS error function (INT 21h, 59h) and returns the
     code value stored for the most-recent error.  DOS stores the most-recent
     error code until a new error occurs.  If your operation is error free,
     this value is not  reset.

     To take this situation into account, ERRORCODE() can alternatively be
     called with <lkeep> set to .T..  If called like this, the error code
     always relates to the last Clipper Tools function that was executed.
     Since the respective Clipper Tools function behavior is stored at an
     internal memory location, it is impossible to implement this option with
     regular Clipper functions.

 Note

     .  You can find a table that contains all the error codes in
        Appendix B:  Error Codes.

 Examples

     .  This example attempts to copy a file.  If an error occurs,
        FILECOPY() returns a value of 0 which offers no specific error
        information:

        nBytes  :=  FILECOPY("TEST\TEST.PRG", "NEW.PRG")
        IF nBytes = 0 .AND. ERRORCODE() = 3
           ? "File path not found!"
        ENDIF

     .  An example of two file copies is illustrated below:

       The first file is unsuccessful, but the second file is not:

        FILECOPY("XXXXX.TXT", "YYYY.TXT")
        ? ERRORCODE(.T.)                  // 2 - File not found
        ? ERRORCODE()                     // 2 - File not found
        FILECOPY("SOURCE.TXT", "TARGET.TXT")
        ? ERRORCODE(.T.)                  // 0 - Last Tools
                                          // function was successful
        ? ERRORCODE()                     // 2 - File not found

     Warning!  Any Clipper Tools function that contains a DOS call
     resets the internal variable retrieved by setting <lKeep> .  The
     following call series never returns the desired result, because the
     first call of ERRORCODE() contains a DOS call:

     ? ERRORCODE(), ERRORCODE(.T.)        // Result: x, 0

See Also: ERRORACT() ERRORBASE() ERRORORG()

 

Tools – System Information

Introduction System Information
BIOSDATE()   Determines the system BIOS date
BOOTCOLD()   Triggers a cold boot
BOOTWARM()   Triggers a warm start of the system
CPUTYPE()    Determines what type of microprocessor in use
DOSPARAM()   Retrieves the DOS command line as a string
ENVPARAM()   Reads the entire DOS environment table into a string
ERRORACT()   Recommends action for a DOS error that has occurred previously
ERRORBASE()  Source of the most-recent DOS error
ERRORCODE()  Identifies a DOS error that has occurred previously
ERRORORG()   Origin of the most-recent DOS error
EXENAME()    Returns name and directory of the current Clipper program
FILESFREE()  Specifies the number of files you can open
FILESMAX()   Specifies maximum number of files that can be open at one time
GETCOUNTRY() Queries country setting for the operating system
ISANSI()     Tests to see if the ANSI screen driver is installed
ISAT()       Determines if a program is running on an AT
ISMATH()     Determines if a math coprocessor is installed
MEMSIZE()    Determines size of conventional or extended memory
NUMBUFFERS() Determines the BUFFERS= setting
NUMFILES()   Determines maximum number of files you can open simultaneously
OSVER()      Returns the DOS version number
PCTYPE()     Returns the type of computer in use
SSETBREAK()  Sets and checks the DOS BREAK switch
SSETVERIFY() Sets and checks the DOS VERIFY switch