FT_DOSVER | Return the current DOS major and minor version as a string |
FT_DSKFREE() | Return the amount of available disk space |
FT_DSKSIZE() | Return the maximum capacity of a fixed disk |
FT_FLOPTST() | Test diskette drive status |
FT_ISSHARE() | Determine if DOS "Share" is installed |
FT_SETDATE() | Set the DOS system date |
FT_SETTIME() | Set the DOS system time |
FT_SYSMEM() | Determine the amount of conventional memory installed |
FT_TEMPFIL() | Create a file with a unique name |
FT_DOSVER() -> <cVersion>
No arguments
A character string with the major version number first, a period ("."), then the minor version number (e.g., "3.30")
FT_DOSVER() invokes DOS interrupt 21h, service 30 in order to return the current DOS version. It does this by setting up an array corresponding to machine registers and then calling the toolkit function FT_INT86().
It returns a character string corresponding to the DOS version, as follows: The major version, a period ("."), then the minor version.
FUNCTION main() RETURN QOut( "Dos version: " + FT_DOSVER() )
FT_DSKFREE( [ <cDrive> ] ) -> nSpaceAvail
Integer representing the available disk space in bytes.
Function to return the available space on the passed drive letter or the default drive if no drive is passed.
Uses FT_INT86() through the internal function _ftDiskInfo().
? FT_DSKFREE() // Returns free space on default drive.
FT_DSKSIZE( [ <cDrive> ] ) -> nMaxCapacity
An integer representing the maximum disk capacity in bytes.
Function utilizing FT_INT86() to return Maximum Disk Size. Uses FT_INT86() through the internal function _ftDiskInfo().
? FT_DSKSIZE() // Maximum capacity for default drive ? FT_DSKSIZE( "D" ) // Maximum capacity for Drive D:
FT_FLOPTST( <nDrive> ) -> nStatus
-1 - Wrong Parameters 0 - Drive Loaded and ready to read or write 1 - Drive Door Open or Diskette inserted upside down 2 - Diskette is unformatted 3 - Write protected 4 - Undetermined
FT_FLOPTST() is designed as a full replacement for ISDRIVE(). Where ISDRIVE() returns just .T. or .F. depending if the diskette drive is ready or not, FT_FLOPTST() returns a numeric code designating the diskette drive's status.
FT_FLOPTST() is particularly useful in backup and restore programs that need to test the floppy drive before writing/reading from a floppy disk.
No testing has been performed on systems with more than 2 floppy drives. If the third drive is "C" and the fourth "D" then there should be no problems.
This function does not currently check subst'd drives. So if you have SUBST E: A:\ then FT_FLOPTST( ASC("E")-ASC("A") ) == 4 Any suggestions to fix this limitation are appreciated.
iStatus := FT_FLOPTST( 0 ) DO CASE CASE iStatus == 1 Qout( "The door to drive A is open." ) CASE iStatus == 2 Qout( "The diskette in drive A is not formatted." ) CASE iStatus == 3 Qout( "The diskette in drive A is write-protected." ) CASE iStatus == 4 Qout( "Something is wrong with drive A, but I don't know what." ) ENDCASE
FT_ISSHARE() -> nRetCode
No arguments
nRetcode will be set as follows on exit:
0 if SHARE not loaded but ok to load 1 if SHARE not loaded and not ok to load 255 if SHARE loaded
Uses DOS interrupt 2Fh (MultiPlex interrupt), service 10h to determine if DOS SHARE.COM is loaded.
IF FT_ISSHARE() != 255 Qout("SHARE must be loaded!") ENDIF
FT_SETDATE( <dDate> ) -> <lResult>
<lResult> is simply the result of FT_INT86(), passed back to your program.
FT_SETDATE() uses NANFOR.LIB's FT_INT86() function to invoke the DOS Set Date service (Interrupt 33, service 43).
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 )
FT_SETTIME( <cTime> ) -> <lResult>
<lResult> is simply the result of FT_INT86(), passed back to your program.
FT_SETTIME() uses NANFOR.LIB's FT_INT86() function to invoke the DOS Set Time service (Interrupt 33, service 45).
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 )
FT_SYSMEM() -> nMemSize
No arguments
A numeric corresponding to the number of K memory.
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).
QOut( "Conventional memory installed: " + Str( FT_SYSMEM() ) + "K" )
FT_TEMPFIL( [ <cPath> ] [, <lHide> ] ) -> cFileSpec
<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.
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().
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\")
Пред. | Начало | След. |
FILE/IO | Уровень выше | MENUS/PROMPTS |