Reading file timestamps

Fluffy's Avatar, Join Date: Jul 2006
Newbie Member
I am reasonably new to C++ and I am having problems with reading a file timestamp. My objective is to just look at the files timestamp, if it is the newest in the folder, want to to move that file to another file. I dont have any need for modifying the timestamp at all. I need to implement this in C++ as it is concerning a windows mobile based device. If any one can help it would be much appreciated, it is pretty urgent as this is for work. thanks
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Use the following code.
Code: CPP
CFileStatus fs;
if (CFile::GetStatus(szFile, fs))
{
    fs.m_mtime = m_FileTime;
    CFile::SetStatus(szFile, fs);
}
Or you can try File Handling Routines
0
Fluffy's Avatar, Join Date: Jul 2006
Newbie Member
Thanks, I figured it out in the end, i used
Code:
timestamp = ctime(&buf.st_mtime);
Only thing was ctime was depeciated but it works for what I needed(was only a tempory solution to the bigger picture)