FT_TEMPFIL

FT_TEMPFIL()
 Create a file with a unique name

 Syntax

      FT_TEMPFIL( [ <cPath> ] [, <lHide> ] ) -> cFileSpec

 Arguments

     <cPath> is the directory where you want to create the temporary
     file.  If you omit this argument, the root of the current drive
     is assumed ("\").

     If <lHide> is .T., then the file will be created with the hidden
     attribute set.  The default is .F.

 Returns

     <cFileSpec> should be your path, including the name of the newly
     created unique file.  Use this with FOPEN(), etc.

     If a DOS error occurred when trying to create the file, a
     null string will be returned.

 Description

     This function uses DOS Interrupt 21, service 5Ah (Create temporary
     file) to create a unique filename in a directory you specify.
     There will be no extension.  After the file is created, you may
     then fopen() it and do any i/o you need (see the test driver
     in the source code).

     This function requires FT_INT86().

 Examples

     Create a unique file in the root of the current drive:

            myFile := FT_TEMPFIL()

     Create a unique file in the current directory and hide it:

            myFile := FT_TEMPFIL(".\", .t.)

     Create a unique file on another drive, but do not hide it:

            myFile := FT_TEMPFIL("e:\nanfor\src\")

 Source: TEMPFILE.PRG

 Author: Glenn Scott

 

Advertisements

FT_SYSMEM

FT_SYSMEM()
 Determine the amount of conventional memory installed

 Syntax

      FT_SYSMEM() -> nMemSize

 Arguments

     None

 Returns

     A numeric corresponding to the number of K memory.

 Description

     FT_SYSMEM() simply reports the amount of conventional memory
     (up to 640K) installed.

     FT_SYSMEM() uses DOS interrupt 12h to get this information.
     For information, refer to Peter Norton's _Programmer's Guide
     to the IBM PC_ (Brady).

 Examples

     QOut( "Conventional memory installed: " + Str( FT_SYSMEM() ) + "K" )

 Source: SYSMEM.PRG

 Author: Glenn Scott

 

FT_SETTIME

FT_SETTIME()
 Set the DOS system time
------------------------------------------------------------------------------

 Syntax

      FT_SETTIME( <cTime> ) -> <lResult>

 Arguments

     <cTime> is a string in the form <hh:mm:ss> that you want to set
     the current DOS system time to.

     Use 24-hour time.  It is up to you to send in a valid time.  If
     DOS doesn't think it is valid, it won't reset the time anyway.

 Returns

     <lResult> is simply the result of FT_INT86(), passed back
     to your program.

 Description

     FT_SETTIME() uses NANFOR.LIB's FT_INT86() function to invoke
     the DOS Set Time service (Interrupt 33, service 45).

 Examples

  The following program takes a time string from the command line and sets
  the DOS system time:

   FUNCTION main( cTime )

      cTime := iif( cTime == nil, time(), cTime )
      QOut( "Setting time to: " + cTime  + "... " )
      FT_SETTIME( cTime )
      Qout( "Time is now: " + time() )

   RETURN ( nil )

 Source: SETTIME.PRG

 Author: Glenn Scott

 

FT_SETDATE

FT_SETDATE()
 Set the DOS system date

 Syntax

      FT_SETDATE( <dDate> ) -> <lResult>

 Arguments

     <dDate> is a Clipper date variable that you want to set the current
     DOS system date to.

     It is up to you to send in a valid date.  The
     year must be within the range 1980 through 2099.  If DOS
     thinks the date is not valid, it won't change the date.

 Returns

     <lResult> is simply the result of FT_INT86(), passed back
     to your program.

 Description

     FT_SETDATE() uses NANFOR.LIB's FT_INT86() function to invoke
     the DOS Set Date service (Interrupt 33, service 43).

 Examples

  The following program takes a date from the command line and sets
  the DOS system date:

   FUNCTION main( cDate )

      cDate := iif( cDate == nil, dtoc( date() ), cDate )
      QOut( "Setting date to: " + cDate  + "... " )
      FT_SETDATE( ctod( cDate ) )
      Qout( "Today is now: " + dtoc( date() ) )

   RETURN ( nil )

 Source: SETDATE.PRG

 Author: Glenn Scott

 

FT_RMDIR

FT_RMDIR()
 Delete a subdirectory

 Syntax

      FT_RMDIR( <cDirName> ) -> nResult

 Arguments

     <cDirName> is the name of the directory to delete.

 Returns

      0  if successful
      3  if Path Not Found
      5  if Access Denied (directory not empty)
     16  if attempt to delete current directory.
     99  if invalid parameters passed

 Description

    This function is useful if you need to remove a subdirectory for
    some reason.

    The source code is written to adhere to Turbo Assembler's IDEAL mode.
    To use another assembler, you will need to rearrange the PROC and
    SEGMENT directives, and also the ENDP and ENDS directives (a very
    minor task).

 Examples

    FT_RMDIR( "C:\CLIPPER" )
    FT_RMDIR( "\EXAMPLE" )
    FT_RMDIR( "..\SOURCE" )

 Source: RMDIR.ASM

 Author: Ted Means

 

FT_REBOOT

FT_REBOOT()
 Force a warm or cold boot

 Syntax

      FT_REBOOT( <nBootType> ) -> NIL

 Arguments

     <nBootType> is used to indicate the type of reboot.  A value of zero
     will cause a cold boot, while any other value will cause a warm boot.

 Returns

     NIL

 Description

     This function is valuable if you need to reboot the PC for some
     reason; e.g. an installation routine that modifies CONFIG.SYS or
     AUTOEXEC.BAT.

     The source code is written to adhere to Turbo Assembler's IDEAL mode.
     To use another assembler, you will need to rearrange the PROC and
     SEGMENT directives, and also the ENDP and ENDS directives (a very
     minor task).

 Examples

     #define COLD 0
     #define WARM 1

     // Issue a warm boot

     FT_Reboot(WARM)

 Source: REBOOT.ASM

 Author: Ted Means

 

FT_POKE

FT_POKE()
 Write a byte to a specified memory location

 Syntax

      FT_POKE( <nSegment>, <nOffset>, <nValue> ) -> lResult

 Arguments

     <nSegment> is the segment of the desired memory address.

     <nOffset>  is the offset of the desired memory address.

     <nValue>   is the value to write to the desired memory address.

 Returns

     <lResult> will be .T. if all parameters were valid and the function was
               able to write the desired byte.
     <lResult> will be .F. if invalid parameters were passed.

 Description

     Use this function if you have a need to change the value at a specific
     memory location.  The function will write the specified byte to the
     specified address.  The value must be passed as a numeric; if the byte
     you wish to use is stored as a character, use the Asc() function
     to convert it.

     This function was written for version 5.1 of MicroSoft C.  You may
     have to modify the source code to use another compiler.

 Examples

     FT_POKE( 0, 1047, 64)  // Turn CapsLock on

 Source: POKE.C

 Author: Ted Means