FT Environment

 FT_COM3OR4()     Enable use of COM3 and/or COM4 on IBM/PC compatables.
 FT_DIR2DB()      Create .DBF of directory files, using DOS filespec
 FT_EXIST()       Test for drive and/or subdir on SINGLE-USER systems only.
 FT_GETE()        Return the entire current environment
 FT_LINKED()      Determine if a function was linked in
 FT_ORIGIN()      Report the drive, path and filename of the current program
 FT_RESTSETS()    Restore status of all SET command settings
 FT_SAVESETS()    Save the status of all the SET command settings
 FT_SETCENTURY()  Check/Set the CENTURY Setting
 FT_TREE()        Locate all directories and subdirectories on a drive
 FT_WHEREIS()     Locate all occurrences of a filespec on a drive

 

FT_WHEREIS

FT_WHEREIS()
 Locate all occurrences of a filespec on a drive

 Syntax

     FT_WHEREIS( [ <cDrive:> ][ <cFilespec> ] ) -> aFiles

 Arguments

    <cDrive:> is an optional drive to search.  If omitted, FT_WHEREIS()
    defaults to the current drive.

    <cFilespec> is a DOS legal filespec containing the pattern that
    you want found.  The wildcard characters "*" and "?" are supported.
    If no <cFilespec> is specified, FT_WHEREIS() defaults to all files.

 Returns

    An array of filenames that match <cFilespec>.

 Description

    Use FT_WHEREIS() to obtain an array with the full path/filenames of all
    files on the specified or current drive that match a DOS legal filespec.

    You may optionally specify a drive to search, other than the current
    drive.  Please note that FT_WHEREIS() will not cause a runtime error if
    you specify an invalid or inoperable drive; it instead returns an
    empty array.

 Examples

    /* Example 1 */
    aComSpec := FT_WHEREIS( "command.com" ) // aComSpec now contains an
                                            // entry for every "Command.com"
                                            // on the current drive
    /* Example 2 */
    aBat := FT_WHEREIS( "a:*.bat" )

    IF Empty( aBat )
       ?"Please make sure the proper diskette is in drive A:, and that"
       ?"the drive door is closed."
    ELSE
       ? "You have " + Len( aBat ) " batch files on drive A:"
    ENDIF

 Source: WHEREIS.PRG

 Author: Steve Larsen

See Also: FT_TREE() FT_ORIGIN()



FT_TREE

FT_TREE()
 Locate all directories and subdirectories on a drive

 Syntax

     FT_TREE( [ <cDrive:> ] ) -> aDirectories

 Arguments

    <cDrive:> is an optional drive to search.  If omitted, FT_TREE()
    defaults to the current drive.

 Returns

    An array containing the name of each directory found on the specified
    drive.

 Description

    Use FT_TREE() to obtain an array of the directory structure of a
    specified drive.

    You may optionally specify a drive to search, other than the current
    drive.  Please note that FT_TREE() will not cause a runtime error if
    you specify an invalid or inoperable drive, instead returns an
    empty array.

    The directory structure returned is not ordered in any way other than
    the order that the directories are contained in DOS.  To put the
    directories in alphabetical order, use ASORT().

 Examples

    // list all directories on the current drive
    aTree := FT_TREE()
    Aeval( aTree, {|e| Qout(e) } )

 Source: WHEREIS.PRG

 Author: Steve Larsen

See Also: FT_WHEREIS() FT_ORIGIN()

 

FT_SETCENTURY

FT_SETCENTURY()
 Check/Set the CENTURY Setting

 Syntax

      FT_SETCENTURY( [ <lNewSetState> ] ) -> <lOldState>

 Arguments

     lNewSetState - Boolean to Set CENTURY
                      .F. - Toggle CENTURY off
                      .T. - Toggle CENTURY on
                      If not specified, leave CENTURY as is

 Returns

     The state of the CENTURY setting upon entry to the routine

 Description

     This function returns the state (ON/OFF, TRUE/FALSE) of the CENTURY
     and optionally sets it ON or OFF.

 Examples

     lOldState := FT_SETCENTURY()     // Get current CENTURY Setting

     lOldState := FT_SETCENTURY(.T.)  // Get the current CENTURY Setting
                                      // and turn it on (set it to TRUE)

     lOldState := FT_SETCENTURY(.F.)  // Get the current CENTURY Setting
                                      // and turn it off (set it to FALSE)

 Source: CNTRYSET.PRG

 Author: David Husnian

 

FT_SAVESETS

FT_SAVESETS()
 Save the status of all the SET command settings

 Syntax

      FT_SAVESETS() -> aOldSets

 Arguments

     None

 Returns

     An array containing the values of the supported SETs.

 Description

     This function saves the SET Settings, i.e., it copies them into an
     array, aOldSets.  The following SETs are not currently supported:
     FILTER, FORMAT, FUNCTION, INDEX, KEYS, MODE, ORDER, PROCEDURE,
     RELATION, TYPEAHEAD

 Examples

     aOldSets := FT_SAVESETS()

 Header File: SET.CH

 Source: SAVESETS.PRG

 Author: David Husnian

See Also: FT_RESTSETS() FT_SETCENTURY()

 

FT_RESTSETS

FT_RESTSETS()
 Restore status of all SET command settings

 Syntax

      FT_RESTSETS( [ <aOldSets> ] ) -> NIL

 Arguments

     aOldSets is an array of SET settings created by FT_SAVESETS()

 Returns

     NIL

 Description

     This function "restores" the SET Settings, i.e., it sets them to the
     values in the array aOldSets.  The following SETs are not currently
     supported: FILTER, FORMAT, FUNCTION, INDEX, KEYS, MODE, ORDER,
     PROCEDURE, RELATION, TYPEAHEAD

 Examples

     FT_RESTSETS(aOldSets)

 Header File: SET.CH

 Source: RESTSETS.PRG

 Author: David Husnian

See Also: FT_SAVESETS() FT_SETCENTURY()



FT_ORIGIN

 FT_ORIGIN()
 Report the drive, path and filename of the current program

 Syntax

     FT_ORIGIN() -> cString

 Arguments

    None

 Returns

    A string containing the full drive/directory/filename of
    the currently executing file.

 Description

    Often users will install multiple copies of application software,
    especially on networks and in situations where the user is trying
    to get around a copy protection scheme.

    This function enables you to learn the name and source location
    of the currently executing file, so that you may take whatever
    action you need to.

    Requires DOS v3.xx and above.

 Examples

    cMyFile := FT_ORIGIN()

    IF cMyFile <> "C:\APPDIR\MYFILE.EXE"
       ?"Incorrect startup file.  Please remove/rename and start again"
       QUIT
    ENDIF

 Header File: extend.h

 Source: ORIGIN.C

 Author: Steve Larsen

See Also: FT_WHEREIS() FT_TREE()

 

FT_LINKED

FT_LINKED()
 Determine if a function was linked in

 Syntax

      FT_LINKED( <cString> ) -> lResult

 Arguments

     <cString> is a character string containing one or more function
               calls

 Returns

     .T. if all functions within the string are currently linked into
     the application, .F. if one or more aren't.  See below for a
     definition of "function."

 Description

     This function would be used in data driven application to determine
     whether or not a macro compiled function was linked in.

     Several functions can be passed, and nested, in <cString>.

     Caveat: Some function calls are converted by the preprocessor
     into other function calls. You cannot have these types of
     functions in a macro compiled string as they never exist at
     runtime. FT_LINKED will correctly tell you that they are invalid.

     For instance: there is no function called SORT() in any of the
     Nantucket LIBraries, but it is a valid CLIPPER command because the
     preprocessor will convert it to other function calls.

 Examples

     cString := "FT_GoodFunc(BadFunc(3,2))"
     IF FT_LINKED(cString)
        EVAL( &("{||"+cString+"}") )
     ELSE
        ALERT("Error: "+cString+" was not linked in. Called by FT_LINKED()")
     ENDIF

 Source: LINKED.PRG

 Author: Brian Loesgen

FT_GETE

FT_GETE()
 Return the entire current environment

 Syntax

      FT_GETE( [ @<xReceiveVar> ] ) -> nNumStrings

 Arguments

     <xReceiveVar> is the variable to receive the environment data.

     <xReceiveVar> can be a character type variable, in which case
     the function will place all environment strings in the variable
     separated by carriage return/line feeds (chr 13 + chr(10)).

     <xReceiveVar> can be an array type, in which case the function
     will place each string in an array element.  The array MUST be
     declared with the proper number of elements prior to passing it
     to the function.  This can be done by calling FT_GETE() without
     parameters first to get the number of strings in the environment.

     Note that the argument MUST be passed by reference. Since arrays
     are by nature passed by reference, the "@" symbol is optional when
     passing an array.

     If no argument is passed, FT_GETE() merely returns the number
     of strings in the environment.

 Returns

     FT_GETE() returns the total number of strings found in the
     current program's environment.

 Description

     This function stores ALL of the current program's environment
     variables in either a block of text lines or in an array.  It is
     useful for looking at the entire environment at once, or recording
     a snapshot of it to a file for later inspection, such as when a
     program error occurs.  If the value of ONE SPECIFIC variable is
     desired, use Clipper's built-in GETE() function.

     This function uses the undocumented internal variable "_environ",
     as well as the functions _strcpy(), _strcat(), and _strlen() from
     CLIPPER.LIB

 Examples

     Get the environment in text form and browse it:

        cEnvBlock   := ""
        nNumStrings := FT_GETE(@cEnvBlock)
        @  0, 0 to MAXROW() - 1, MAXCOL()
        @  MAXROW(), 0 say 'Browse strings, press ESC to exit...'
        MEMOWRIT(cEnvBlock, 1, 1, MAXROW() - 2,MAXCOL() - 1, .F.)

     Get the environment in text form and write it to a file:

        cEnvBlock := ""
        FT_GETE(@cEnvBlock)
        MEMOWRIT("ENVIRON.TXT", cEnvBlock)

     Get the environment in Array form:

        aEnvArray := ARRAY(FT_GETE())
        FT_GETE(aEnvArray)
        ? aEnvArray[1]       // "COMSPEC=C:\COMMAND.COM"
        ? aEnvArray[2]       // "PATH=C:\;C:\DOS;C:\UTIL;C:\CLIP50\BIN"
          ... etc ...

 Source: GETENVRN.C

 Author: Rick Whitt

FT_EXIST

FT_EXIST()
 Test for drive and/or subdir on SINGLE-USER systems only.

 Syntax

      FT_EXIST( <cDriveDir> ) -> lResult

 Arguments

     <cDriveDir> is a character string containing drive spec (with colon)
     or drive spec and path to and including subdirectory being tested
     for.  Do not include backslash after subdirectory.  If drive spec
     is not part of string, the current drive is tested.

 Returns

     <lResult>  as logical -
     .T. if drive exists, or subdirectory exists on specified drive
     .F. if drive or subdirectory does not exist

 Description

     FT_Exist() tests for the existence of a drive and/or subdirectory...
     on single-user systems ONLY.  You may get correct results on some
     networks under certain conditions, but this function is not capable
     of working reliably on networks.

 Examples

    IF FT_EXIST( "D:" )
       Qout("OK To Perform Operation On Drive D:")
    ENDIF

 Source: EXIST.PRG