Solved

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

Posted on 2008-09-30
2
379 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 10 powershell/cmd/bash alternatives? 11 58
Bulk Reorder File Names 4 67
Installation of Nessus Professional 5 95
How to safely test out TFTP server software 12 63
Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
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…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
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…

770 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