Dangerous CFile::GetStatus
Friday, October 1st, 2010The third (and I hope final) dangerous posting.
This code looks harmless enough:
CFileStatus rStatus; CFile::GetStatus (MyFilename, rStatus);
And it will work most of the time. But CFileStatus uses CTime, which is limited to dates after 1.1.1970. If you apply this code to a file with a file-modification date of e.g. 1.1.1960, GetStatus will raise an exception. (Which it isn’t documented to to.) And if you don’t catch that, it will terminate your program.