如何获取文件时间?
?? 问题点数:90、回复次数:6Top
1 楼karma(无为MS MVP)回复于 2002-02-26 08:18:13 得分 20
use CFile::GetStatus():
CFileStatus status;
char* pFileName = "test.dat";
if( CFile::GetStatus( pFileName, status ) ) // static function
{
//m_*time is of type of CTime
status.m_ctime;//The date and time the file was created.
status.m_mtime;//The date and time the file was last modified.
status.m_atime;//The date and time the file was last accessed for reading.
status.m_size;//The logical size of the
}Top
2 楼yjf7888(seeking a place 找工作了location:Chengdu)回复于 2002-02-26 08:18:43 得分 20
是不是GetFileTime
The GetFileTime function retrieves the date and time that a file was created, last accessed, and last modified.
BOOL GetFileTime(
HANDLE hFile, // handle to file
LPFILETIME lpCreationTime, // creation time
LPFILETIME lpLastAccessTime, // last access time
LPFILETIME lpLastWriteTime // last write time
);
Parameters
hFile
[in] Handle to the files for which to get dates and times. The file handle must have been created with GENERIC_READ access to the file.
lpCreationTime
[out] Pointer to a FILETIME structure to receive the date and time the file was created. This parameter can be NULL if the application does not require this information.
lpLastAccessTime
[out] Pointer to a FILETIME structure to receive the date and time the file was last accessed. The last access time includes the last time the file was written to, read from, or, in the case of executable files, run. This parameter can be NULL if the application does not require this information.
lpLastWriteTime
[out] Pointer to a FILETIME structure to receive the date and time the file was last written to. This parameter can be NULL if the application does not require this information.Top
3 楼GJA106(中文字符)回复于 2002-02-26 08:20:06 得分 20
到这儿看一看:http://download.lycos.com.cn/program/article/vc/vc407.html
相应可参考:
http://www.ccidnet.com/tech/guide/2000/04/12/58_576.htmlTop
4 楼ylb_and_xy(黑狐狸)回复于 2002-02-26 08:30:00 得分 10
GetFileInformationByHandle(....) or GetFileTime(...) functionTop
5 楼public(九天十地菩萨摇头怕怕,霹雳金光雷电掌@!@)回复于 2002-02-26 08:30:26 得分 20
The WIN32_FIND_DATA structure describes a file found by the FindFirstFile, FindFirstFileEx, or FindNextFile function.
typedef struct _WIN32_FIND_DATA { // wfd
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA;
ftLastAccessTime
Specifies a FILETIME structure containing the time that the file was last accessed. The time is in UTC format; the FILETIME members are zero if the file system does not support this time member.
ftLastWriteTime
Specifies a FILETIME structure containing the time that the file was last written to. The time is in UTC format; the FILETIME members are zero if the file system does not support this time member.
Top
6 楼111222(www.111222.cn)回复于 2002-02-26 17:32:51 得分 0
只需要人民币20元,
你就可以获得本灌水机的程序和Visual C++源代码,
并获得永久性技术支持。
还等什么?灌水等着你!
就在今夜!元宵佳节!
(可怜我的信誉)Top




