home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- * TEST program for ------- DISKSIZE, DISKTEST, SETINT24, GETINT24
- * FILE = T_DISKS.PRG
- *****************************************************************
- *
- * Copyright(c) 1991 -- James Occhiogrosso
-
- # include "setcurs.ch"
- # include "inkey.ch"
-
- LOCAL disk_drive := ' ', disk_error:= disk_num := keypress := 0,;
- old_cursor := SETCURSOR()
-
- INITGLOBAL()
- SETCOLOR(colstd)
- CLEAR
-
- DO WHILE keypress != K_ESC
-
- @ 10, 20 SAY 'Enter letter for disk drive to test ...... ' ;
- GET disk_drive PICTURE '!' VALID !EMPTY(disk_drive)
-
- READ
-
- * Turn off the cursor
- SETCURSOR(SC_NONE)
-
- * Test the disk specified by the value of "disk_drive"
- disk_error = DISKTEST(disk_drive)
-
- IF disk_error != 0
- * An error occurred, display error message
- DO CASE
- CASE disk_error = 1
- @ 12, 20 SAY 'Disk in Drive ' + disk_drive + ;
- ' is write protected.'
-
- CASE disk_error = 3
- @ 12, 20 SAY 'Drive ' + disk_drive + ;
- ' is not ready.'
-
- CASE disk_error = 13
- @ 12, 20 SAY 'Disk in Drive ' + disk_drive + ;
- ' is not formatted.'
-
- CASE disk_error = -1
- @ 12, 20 SAY 'Drive ' + disk_drive + ;
- ' is not a valid drive.'
- ENDCASE
-
- ELSE
-
- @ 12, 20 SAY 'Drive ' + disk_drive + ' is ready. '
-
- * Note that Clipper DISKSPACE and Developer's Library
- * DISKSIZE use numeric values for the disk argument.
- * The drive letter is translated to a number (A=1, B=2,
- * etc.) before calling either function. This is done by
- * subtracting 64 from its ASCII equivalent.
-
- disk_num = ASC(disk_drive) - 64
-
- * Display total disk size and free space.
-
- @ 13, 20 SAY 'Formatted size of this disk is = ' + ;
- LTRIM(STR(DISKSIZE(disk_num))) + ' bytes.'
-
- @ 14, 20 SAY 'It has ' + LTRIM(STR(DISKSPACE(disk_num)));
- + ' bytes free.'
-
- ENDIF
-
- * Reset the cursor and display message
- SETCURSOR(old_cursor)
- @ 17, 20 SAY 'Press any key to loop or Esc to exit.'
- keypress = INKEY(0)
- @ 12, 20 CLEAR TO 17, 70
-
- ENDDO
-
- RETURN
-
-
-