----- Original Message -----=20
From: Wayne J May=20
To: dev...@li...=20
Sent: Wednesday, February 23, 2005 21:43 PM
Subject: [Dev-C++] Getting the File Date
Hey,
Just wondering if it is possible to get a file's last modified date, =
or the created date ? I need this for a server side project that I am =
working on, but the program will have to check the actual date of the =
file. How can I do this in C or C++ using MS Windows ?
--
This email was scanned for a virus with an up to date virus database, =
on the sender's PC.
We will not be held responsible, should this email become infected.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 2/22/2005
Try This:
#include <dir.h>
#include <io.h>
union FF
{
unsigned i[2];
struct ftime f;
} u;
main()
{
struct ffblk ff;
findfirst("tc.exe", &ff, 0);
u.i[0]=3D ff.ff_ftime;
u.i[1]=3D ff.ff_fdate;
printf("date=3D %d/%d/%d time=3D %d:%d:%d\n",
u.f.ft_month, u.f.ft_day, u.f.ft_year+80,
u.f.ft_hour, u.f.ft_min, u.f.ft_tsec);
return 0;
}
--
Slackrat |