#OpenFile API
03-Oct-91 03:08:19
Sb: #OpenFile API
Fm: Dennis L. Harrington 76216,3472
To: Costas Kitsos 73667,1755
Costas,
A field in the OFSTRUCT data type returned by the OpenFile function is a
4 byte field named "reserved". In Petzold's book, he says this field is
used with the OF_READ flag to compare a file's date/time. Does this mean
that it might be possible to somehow use this field to get a file's
date/time? Redefining it as a single and using it with format$ seems to
always return 12/30/99 12:00pm no matter what the value. Could this just be
a long with the number of seconds since some date?
BTW, OpenFile when used with the OF_EXIST flag is a great way to test for
a file's existence! In FM, I can read the font master file and test each
font's files for existence extremely quickly. It reads the master file and
tests 197 pfm files for existence in right at 1 second! Makes it real nice
to insure new entries in win.ini and atm.ini are for files that truly
exist. Also makes creating a VB FileExist function super simple.
Function FileExist (filename$) as integer
dim oFdat as OFSTRUCT
e = OpenFile(filename$, oFdat, OF_EXIST)
if e = -1 then
FileExist = false
else
FileExist = true
end if End Function
–dennis
There are 2 Replies.