PDA

View Full Version : [LF] file creation date-time


Lahey Support
08-15-2003, 01:24 AM
Hassan asked how to time-stamp an ascii file at the end.

This is not necessary, since the directory has this
information, so you only have to execute the routine
that tells you what information is in the directory
entry for that file name.

This is interrupt 21h, service Hex 5700.
Ax = 5700h
Bx = file handle number
EXCUTE INTERRUPT 21h:
Cx returns file creation time hhhhhmmmmmmsssss as integer*2,
Dx returns file creation date YYYYYYYMMMMDDDDD as integer*2.

This is done in Lahey, by the call interrupt 21h service,
passing the integer*2 register contents and getting back
the new values.

Another way is to execute an in-line system call
(see your manual on how the compiler does this), e.g.
CALL SYSTEM('dir filename > listname'C)
then read the contents of the listname file created.
This also gives file length, besides data and time.

Getting the computer date is done the same way:-
date with with service 2A00h, time with 2C00h,
and no parameters.
Get date returns:-
AX = xxxxxxxxwwwwwwww (ignore x, w=weekday number)
CX = year
DX = MMMMMMMMDDDDDDDD (Month M, Day D)

Get time returns:-
CX = hhhhhhhhmmmmmmmm (hour h 0-24, minutes m 0-59)
DX = sssssssszzzzzzzz (seconds s 0-59, z hundredths 0-99)

There is an intrinsic service in Lahey fortran for date-time.

Terence Wright

-----------------------------------------------------
To unsubscribe from the Fortran Forum, send a message
to [address removed] with the following command as
the first and only line of the message body:
unsubscribe fortran
-----------------------------------------------------