Solved

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

Posted on 2008-09-30
2
376 Views
Last Modified: 2013-11-15
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
0
Comment
Question by:leonvan
  • 2
2 Comments
 
LVL 6

Expert Comment

by:RishadanPort
ID: 22609903
Use the stat function, which contains everything about a file, including when it was created. Let me find some information for you.
0
 
LVL 6

Accepted Solution

by:
RishadanPort earned 500 total points
ID: 22609945
Here is a good link about using stat:

http://en.wikipedia.org/wiki/Stat_(Unix)

However, I am not 100 percent certain if this works using windows server, since I have never used this approach on a windows server
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The viewer will learn how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now