Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Reading file timestamps (http://www.go4expert.com/forums/reading-file-timestamps-t1006/)

Fluffy 13Jul2006 15:04

Reading file timestamps
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

shabbir 14Jul2006 11:09

Re: Reading file timestamps
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

Fluffy 14Jul2006 14:12

Re: Reading file timestamps
Thanks, I figured it out in the end, i used

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) :D

All times are GMT +5.5. The time now is 19:48.