Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get the 'modified' time of a file?

7 views
Skip to first unread message

dududuil

unread,
Nov 18, 2009, 2:29:02 AM11/18/09
to
I need a way to get the modified time of a file (the same data you can get by
right clicking the file on the file explorer)
So I have writen:

CTime GetTime(LPCTSTR name)
{
if (f.Open(name,CFile::modeRead)) {
CFileStatus fileStat;
if (f.GetStatus(fileStat))
return fileStat.m_mtime;
}
return 0;
}

In most cases this works just fine. The problem is that CFile::Open
sometimes fails. Usually because the file is being read elsewhere.

So this solution is not good enough for me.

Is there a better (safer) way to receive this data?
Maybe using CFile is wrong?
Please help!

Thanks
Dudu Arbel

Tom Serface

unread,
Nov 18, 2009, 5:19:10 PM11/18/09
to
Did you get the answer in the replies in the other thread with the same
title?

Tom

"dududuil" <dudu...@discussions.microsoft.com> wrote in message
news:7FFCF5B7-8C49-4D33...@microsoft.com...

0 new messages