=====> 怎样比较两个文件的版本???

cd7809 2002-12-01 08:17:16

我在copy文件之前想比较一下两个文件的版本, 只有源文件版本高的时候才copy, 不知怎么处理, 非常感谢!!
...全文
80 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Rigel 2002-12-01
  • 打赏
  • 举报
回复
BOOL GetFileInformationByHandle(
HANDLE hFile, // handle to file
LPBY_HANDLE_FILE_INFORMATION lpFileInformation // buffer
);
TrueDexter 2002-12-01
  • 打赏
  • 举报
回复
如果是DLL的话可以用API:
是 GetDllVersion 或 GetFileVersion 之类的名字,你查一查吧.
cbc 2002-12-01
  • 打赏
  • 举报
回复
CString strPath="C:\\hello.txt";
CFile file;
file.Open(strPath,CFile::modeRead);
CFileStatus fstatus;
file.GetStatus(strPath,fstatus)


CFile::GetStatus
BOOL GetStatus( CFileStatus& rStatus ) const;

static BOOL PASCAL GetStatus( LPCTSTR lpszFileName, CFileStatus& rStatus );

Return Value

TRUE if the status information for the specified file is successfully obtained; otherwise, FALSE.

Parameters

rStatus

A 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.
lpszFileName

A 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.

Remarks

The virtual version of GetStatus retrieves the status of the open file associated with this CFile object. It does not insert a value into the m_szFullName structure member.

The static version gets the status of the named file and copies the filename to m_szFullName. This function obtains the file status from the directory entry without actually opening the file. It is useful for testing the existence and access rights of a file.

The m_attribute is the file attribute. The Microsoft Foundation classes provide an enum type attribute so that you can specify attributes symbolically:

enum Attribute {
normal = 0x00,
readOnly = 0x01,
hidden = 0x02,
system = 0x04,
volume = 0x08,
directory = 0x10,
archive = 0x20
};

Example

//example for CFile::GetStatus
CFileStatus status;
extern CFile cfile;
if( cfile.GetStatus( status ) ) // virtual member function
{
#ifdef _DEBUG
afxDump << "File size = " << status.m_size << "\n";
#endif
}
char* pFileName = "test.dat";
if( CFile::GetStatus( pFileName, status ) ) // static function
{
#ifdef _DEBUG
afxDump << "Full file name = " << status.m_szFullName << "\n";
#endif
}

zhangyilan 2002-12-01
  • 打赏
  • 举报
回复
不知道一般的文件属性中是否有版本一项
关注
Re:计算机网络  应用层 诸多协议 实验环境搭建  DNS、DHCP、HTTP、FTP、Telnet、RDP、STMP、POP3、IMAP======================# 应用层 诸多协议 域名系统 DNS 动态主机配置协议 DHCP 超级文本传输协议 HTTP 文件传输协议 FTP Telnet 协议和 RDP(远程桌面协议) 发送电子邮件的协议 SMTP  接收电子邮件的协议 POP3 和 IMAP # 什么是域名 整个Internet网站和各种服务器数量众多,各个组织的服务器都需要给一个名称,这就很容易重名。如何确保Internet上的服务器名称在整个Internet唯一呢?这就需要Internet上有域名管理认证机构进行统一管理。如果你的公司在互联网上有一组服务器(邮件服务器、FTP服务器、Web服务器等),你需要为你的公司先申请一个域名,也就是向管理认证机构注册一个域名。 域名的注册遵循先申请先注册为原则,管理认证机构要确保每一个域名的注册都是独一无二、不可重复的。 # 动态主机配置协议 DHCP 静态地址和动态地址应用场景 DHCP 地址租约 DHCP 租约生成过程 DHCP 地址租约更新 # Telnet 协议 Telnet是一个简单的远程终端协议(非加密、且简单),它也是因特网的正式标准。用户使用telnet客户端就可以连接到远程运行Telnet服务的设备(可以是网络设备例如:路由器、交换机,也可以是操作系统,比如Windows或Linux等),进行远程管理。 Telnet能将用户的键盘指令传到远地主机,同时也能将远地主机的输出通过TCP连接返回到用户屏幕。这种服务是透明的,因为用户感觉到好像键盘和显示器是直接连在远地主机上。因此,Telnet又称为终端仿真协议。 Telnet并不复杂,以前应用得很多。现在由于操作系统(Windows和Linux)功能越来越强,用户己较少使用Telnet了。不过配置Linux服务器和网络设备还是需要 Telnet 来实现远程管理和配置 # 远程桌面协议 RDP 现在Windows操作系统很少使用telnet进行远程管理了,更多是使用远程桌面进行远程管理。 Windows系统启用远程桌面,客户端使用远程桌面客户端(mstsc)进行连接。 它们之间使用RDP协议进行通信,RDP协议默认使用TCP的3389端口。 # http 协议、版本和网页 创建网页(准备创建网站、需要设计网页和安装Web服务器) 统一资源定位符URL 绝对路径和相对路径 创建Web站点 HTTP协议版本 HTTP请求报文和响应报文 HTTP响应报文: Cookie 通过代理服务器访问网站 # 文件传输协议 FTP FTP 是File Transfer Protocol(文件传输协议)的英文简称。用于Internet上的控制文件的双向传输。基于不同的操作系统有不同的FTP应用程序,而所有这些应用程序都遵守同一种协议以传输文件。 在FTP的使用当中,用户经常遇到两个概念:“下载”(Download)和“上传”(Upload)。“下载”文件就是从远程主机拷贝文件至自己的计算机上;“上传”文件就是将文件从自己的计算机中拷贝至远程主机上。用Internet语言来说,用户可通过客户机程序向(从)远程主机上传(下载)文件。 简单地说,支持FTP协议的服务器就是FTP服务器。 # 安装和配置邮件服务器  模拟整个互联网发送邮件的过程 发送电子邮件的协议 SMTP  接收电子邮件的协议 POP3 和 IMAP--------------------------------------              

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧