home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SAMPLES.EXE / T_FILES.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  1.8 KB  |  61 lines

  1. *****************************************************************
  2. * Test program for FILEDATE, FILESIZE, FILETIME, FILETOUCH
  3. *                  FILE = T_FILES.PRG
  4. *****************************************************************
  5.  
  6. * Copyright(c) 1991 -- James Occhiogrosso
  7.  
  8. # include "inkey.ch"
  9.  
  10. INITGLOBAL()
  11. SETCOLOR(colstd)
  12. CLEAR
  13.  
  14. * Save original date and time of this program file,
  15. * and reset it to system date and time.
  16. filename = 't_files.prg'
  17. orig_date = FILEDATE(filename, DATE())
  18. orig_time = FILETIME(filename, TIME())
  19.  
  20. * Stuff a space in keyboard to start the loop
  21. KEYBOARD CHR(32)
  22.  
  23. DO WHILE INKEY(0)  != K_ESC
  24.  
  25.     CLEAR
  26.     * Display the original date and time settings
  27.     @ 6, 10 SAY 'The size of .......... ' + UPPER(filename) + ;
  28.                   ' is ' + LTRIM(STR(FILESIZE(filename)))
  29.     @ 8, 10 SAY 'It was dated ......... ' + DTOC(orig_date)
  30.     @ 9, 10 SAY 'And had a time of .... ' +  orig_time
  31.  
  32.     * Set date and time to system date and time
  33.     FILETOUCH(filename)
  34.  
  35.     * Retrieve its date and time using FILEDATE and FILETIME
  36.     @ 11, 10 SAY 'Its new date is ...... ' + ;
  37.                  DTOC(FILEDATE(filename))
  38.     @ 12, 10 SAY 'And its new time is .. ' + FILETIME(filename)
  39.  
  40.     @ 15, 10 SAY 'Press any key to set date and time' + ;
  41.                  ' back to original values'
  42.     INKEY(0)
  43.  
  44.     * Reset the file back to original values
  45.     FILEDATE(filename, orig_date)
  46.     FILETIME(filename, orig_time)
  47.  
  48.     * And display the original values
  49.     @ 17, 10 SAY 'Date setting is now .. ' + ;
  50.                   DTOC(FILEDATE(filename))
  51.     @ 18, 10 SAY 'Time setting is now .. ' + ;
  52.                   FILETIME(filename)
  53.  
  54.     @ 24, 10 SAY 'Press any key to begin again or Esc to exit'
  55.  
  56. ENDDO
  57.  
  58. CLEAR
  59. RETURN
  60.  
  61.