Re: Number Conversions

 BBS: Inland Empire Archive
Date: 04-05-92 (22:23)             Number: 80
From: DONN BLY                     Refer#: 61
  To: KEVIN NEWELL                  Recvd: NO  
Subj: Re: Number Conversions         Conf: (2) Quik_Bas
 >
 >  DB> Well, what I would use is a call to
 >  DB> interrupt 21, specifically the
 >  DB> FindFirst function, and pull the
 >  DB> date/time stamp out of the DTA.
 >
 >  DB> You will want to save the DTA and restore
 >  DB> it on exit from the routine
 >  DB> so that you don't corrupt your command line, but the rest is a
 >  DB> "simple" matter of stripping the
 >  DB> information out of the dos date
 >  DB> format.
 >
 > Ok now I am cornfused (sp intentional!)

Ok, try this:
_ _ _ O_/_ _C_U_T_ _H_E_R_E_ _ _ _ _ _ _
      O \
FUNCTION GetDate$ (Path$)
'  Here is the code you asked for.  I yanked this out of an old program that
'  I wrote a few years ago.  The underscores at the end of the lines are
'  there so that the code doesn't line wrap in the message, and so that QB
'  will re-assemble it at your end.
'
'  ** Note ** This code was originally written in QuickBASIC, but was
'  ********** converted to PDS 7.0.  For QB replace SSEG() with VARSEG()

   REDIM DirRegArray%(10)               ' Needed for calls to Int86XOld()

   GetDateDTA$ = STRING$(43, 32)
   AsciiZPath$ = Path$ + CHR$(0)

   ' Get current DTA address, store it to be restored later

   DirRegArray%(0) = &H2F00             ' AX
   CALL INT86XOLD(&H21, DirRegArray%(), DirRegArray%())
   segment% = DirRegArray%(9)           ' ES
   offset% = DirRegArray%(1)            ' BX

   ' Set dta address to our temporary one

   DirRegArray%(0) = &H1A00             ' AX
   DirRegArray%(8) = SSEG(GetDateDTA$)  ' DS
   DirRegArray%(3) = SADD(GetDateDTA$)  ' DX
   CALL INT86XOLD(&H21, DirRegArray%(), DirRegArray%())

   ' Use _Dos_FindFirst() to get file information

   DirRegArray%(0) = &H4E00              ' AX
   DirRegArray%(2) = 63                  ' CX
   DirRegArray%(8) = SSEG(AsciiZPath$)   ' DS
   DirRegArray%(3) = SADD(AsciiZPath$)   ' DX
   CALL INT86XOLD(&H21, DirRegArray%(), DirRegArray%())

   ' Save the flag to determine if the file was found

   ReturnCode% = DirRegArray%(7) AND 1

   ' Reset the DTA to the original address

   DirRegArray%(0) = &H1A00             ' AX
   DirRegArray%(8) = segment%           ' DS
   DirRegArray%(3) = offset%            ' DX
   CALL INT86XOLD(&H21, DirRegArray%(), DirRegArray%())

   IF ReturnCode% THEN
      GetDate$ = ""  ' File not found
   ELSE              ' Lets get what we want out of the DTA
      dat% = CVI(MID$(GetDateDTA$, 25, 2))
      Day% = dat% AND &H1F
      Month% = (dat% \ 32) AND &HF
      Year% = ((dat% \ 512) AND &H1F) + 1980
      GetDate$ = RIGHT$("0" + LTRIM$(STR$(Month%)), 2) + "-" _
               + RIGHT$("0" + LTRIM$(STR$(Day%)), 2) + "-" _
               + LTRIM$(STR$(Year%))
   END IF
END FUNCTION

--- OPMED 3.00
 * Origin: The Loft *HST/DS/V42bis* [NC, SDS] (1:236/7)
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