Re: File Date/Time

 BBS: Inland Empire Archive
Date: 03-31-93 (06:47)             Number: 351
From: DICK DENNISON                Refer#: NONE
  To: MICHAEL BAILEY                Recvd: NO  
Subj: Re: File Date/Time             Conf: (2) Quik_Bas
'>>> Start of page 4 of dt.bas

       BEEP
       a$ = ""
       GOTO getnumtop
   END IF
   nu$ = nu$ + a$

   a$ = ""
NEXT n%
   IF VAL(nu$) > max% OR VAL(nu$) < min% THEN
       BEEP
       nu$ = ""
       GOTO getnumtop
   END IF
PRINT
GetNum% = VAL(nu$)
END FUNCTION

FUNCTION gettime&
'mo% = GetNum%(2, 1, 12)
gtimetop:
PRINT "New Hour (00-23): ";
hour% = GetNum%(2, -1, 23)
IF hour% < 0 THEN
   gettime& = fi.timef + 0&
   PRINT "Use old time"
   EXIT FUNCTION
END IF

PRINT "New Minutes (00-59): ";
min% = GetNum%(2, 0, 59)
PRINT "New Seconds (00-59) : ";
sec% = GetNum%(2, 0, 59)

PRINT "          New file time : " + LTRIM$(STR$(hour%)) + ":" + _
 LTRIM$(STR$(min%)) + ":" + LTRIM$(STR$(sec%))
'timef%   'bits 0-4h=2secincs(0-29),5-Ah=mins(0-59),B-Fh=Hours(0-23)
         ' +                      , * 32          ,*2048
timef& = hour% * 2048& + min% * 32& + sec%
gettime& = timef&
END FUNCTION

SUB SetFileDate (filename$, datef&, timef&)
DIM regs AS RegType
OPEN filename$ FOR APPEND AS 1
handle% = FILEATTR(1, 2)

regs.ax = &H5700 + 1 'SET file date/time  + 0 the GET
regs.bx = handle%    'file handle

'timef%   'bits 0-4h=2secincs(0-29),5-Ah=mins(0-59),B-Fh=Hours(0-23)
         ' +                      , * 32          ,*2048
'timef% = 2 * 2048 + 22 * 32
'datef%   'bits 0-4h=day(1-31),5-8h=month(1-12),9-Fh=year-1980
         ' +                      , * 32          ,*512
'datef% = 12 * 512 + 6 * 32 + 16
IF timef& > 32767 THEN tim% = timef& - 65536 ELSE tim% = timef&
IF datef& > 32767 THEN dat% = datef& - 65536 ELSE dat% = datef&
regs.cx = tim%
regs.dx = dat%

CALL INTERRUPT(&H21, regs, regs)
IF regs.flags AND 1 THEN BEEP
CLOSE 1
END SUB


______O_/_________________| SNIP |________________\_O_____
      O \                 | HERE |                / O


--- VP [DOS] V4.09e
 * Origin: The MailMan  (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET