CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

如何获取文件时间?

楼主l63(小虾米)2002-02-26 07:57:49 在 VC/MFC / 基础类 提问

?? 问题点数: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

相关问题

  • 如何获取文件的时间
  • 如何获取文件的更新时间
  • 如何获取文件的创建时间?
  • linux/unix如何获取一个文件的创建时间呢?
  • 如何获取文件的访问和修改时间属性
  • 如何获取指定文件的创建时间?急!!
  • 如何获取已知URL对应文件的修改时间
  • Java如何获取一个文件的修改时间?
  • 如何获取文件名?
  • 如何获取文件名

关键词

  • win32
  • access
  • date
  • lpfiletime
  • status
  • time
  • handle
  • read
  • created

得分解答快速导航

  • 帖主:l63
  • karma
  • yjf7888
  • GJA106
  • ylb_and_xy
  • public

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo