Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading File Create Date in C++

Status
Not open for further replies.

JohnConklin

Programmer
Feb 7, 2002
1
US
Hello,

I am new to C++ programming and need some help.

I am confused on to read the file create date of any files stored in a directory on my computer.

I need to read the file create date, and if the file is older than 48 hours I want to delete the file.

Any suggestions?

Thanks,
John Conklin
 
You could either use GetFileAttributesEx or FindFirstFile

WIN32_FILE_ATTRIBUTE_DATA FileData;
BOOL bRet = GetFileAttributesEx(_T("c:\\test.txt"), GetFileExInfoStandard,
&FileData);

or

WIN32_FIND_DATA FindData;
HANDLE hFind = FindFirstFile("c:\\test.txt", &FindData);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top