Link to home
Start Free TrialLog in
Avatar of leonvan
leonvan

asked on

c programing (gcc with cygwin) math to see how many days old a file is

Inside in existing C program running in windows server 2003, I need to do math to find out if a file is the file more than X days old (e.g. more the 3 days old, more than 7 datys old, etc.).  I am using the gcc compiler (ver. 3.4.4) that installs with cygwin.  It apparently does not support __ing64.  The filetime() function says

    "It is not recommended that you add and subtract values from the FILETIME structure to obtain relative  
    times. Instead, you should copy the low- and high-order parts of the file time to a ULARGE_INTEGER
    structure, perform 64-bit arithmetic on the QuadPart member, and copy the LowPart and HighPart
    members into the FILETIME structure."

Is there an easier way to do this, or can someone point me to or provide examples doing the 64-bit math on the quadpart and reading the high and low parts back out?

Thanks,
Leon
Avatar of RishadanPort
RishadanPort

Use the stat function, which contains everything about a file, including when it was created. Let me find some information for you.
ASKER CERTIFIED SOLUTION
Avatar of RishadanPort
RishadanPort

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial