Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-09-30
2
Medium Priority
?
390 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Curious about the latest ransomware attack? Check out our timeline of events surrounding the spread of this new virus along with tips on how to mitigate the damage.
Viewers will learn how to use the Hootsuite Dashboard.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

704 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