我用CreateFile创建了一个文件.但是查看它的属性发现创建日期不对.以下是属性上的内容:
创建时间: 2006年8月21日, 21:36:34
修改时间: 2006年8月21日, 21:36:34
访问时间: 2006年8月21日, 14:37:14另外我的系统时间也是正确的,是2006年8月21日, 14:37的啊~!怎么会这样子呢?
求解:如何才能更改创建时间?如果创建时间改不了,那么如何更改修改时间?

解决方案 »

  1.   

    CFile::GetStatus   获得创建时间
    SetLastWriteTime() 重新设置文件最近修改时间
      

  2.   

    CFile::GetStatus 
    BOOL GetStatus( CFileStatus& rStatus ) const;static BOOL PASCAL GetStatus( LPCTSTR lpszFileName, CFileStatus& rStatus );Return ValueTRUE if the status information for the specified file is successfully obtained; otherwise, FALSE. ParametersrStatusA reference to a user-supplied CFileStatus structure that will receive the status information. The CFileStatus structure has the following fields: CTime m_ctime   The date and time the file was created.
    CTime m_mtime   The date and time the file was last modified.
    CTime m_atime   The date and time the file was last accessed for reading.
    LONG m_size   The logical size of the file in bytes, as reported by the DIR command.
    BYTE m_attribute   The attribute byte of the file.
    char m_szFullName[_MAX_PATH]   The absolute filename in the Windows character set. 
    lpszFileNameA string in the Windows character set that is the path to the desired file. The path can be relative or absolute, but cannot contain a network name.
      

  3.   

    恩,谢谢楼上的~!问题已经解决了,不过代码修改文件创建时间是实现不了的.这个文件时间是可能是由于Smartphone由于时区不同导致的.