1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reading file timestamps

Discussion in 'C' started by Fluffy, Jul 13, 2006.

  1. Fluffy

    Fluffy New Member

    Joined:
    Jul 13, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    Use the following code.
    Code:
    CFileStatus fs;
    if (CFile::GetStatus(szFile, fs))
    {
        fs.m_mtime = m_FileTime;
        CFile::SetStatus(szFile, fs);
    }
    Or you can try File Handling Routines
     
  3. Fluffy

    Fluffy New Member

    Joined:
    Jul 13, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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) :D
     

Share This Page