c++ 获取文件修改时间

SYSTEMTIME OnTime64toSystemTime(__time64_t& itime)
{
	struct tm *temptm = _localtime64(&itime);
	SYSTEMTIME st = {1900 + temptm->tm_year, 
		1 + temptm->tm_mon, 
		temptm->tm_wday, 
		temptm->tm_mday, 
		temptm->tm_hour, 
		temptm->tm_min, 
		temptm->tm_sec, 
		0};
	return st;
}
void GetModifyDateTime(const wstring& strFilename, SYSTEMTIME& stLocal)
{
	struct _stat64i32 statbuf; 
	_wstat64i32(strFilename.c_str(), &statbuf);
	stLocal = OnTime64toSystemTime(statbuf.st_mtime);
}

 

调用:

 

SYSTEMTIME stLocal;
	GetModifyDateTime(L"E:\\123.dx", stLocal);

引用:https://blog.csdn.net/sz76211822/article/details/78123437

你可能感兴趣的:(MFC,Windows,文件信息)