确定文件在c复制或不 [英] Determining if file has been copied or not in C

查看:83
本文介绍了确定文件在c复制或不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图让一个C程序来确定文件已在C复制与否原本我以为修改时间会在复制文件改变,但事实并非如此。有没有人有一个程序,我可以使用这个项目?我使用Windows 7,谢谢!

I have been trying to make a C program to determine if file has been copied or not in C. Originally I thought the modification time would change upon copying the file but it does not. Does anyone have a program I can use for this project? I am using windows 7. Thanks!

推荐答案

看看的的 getFileTime() 功能。我认为它你问什么了。链接给你code的例子。 code的签名是这样的:

Take a look at the getFileTime() function. I think it does exactly what you are asking for. The link gives you code examples. Code signature looks like this:

BOOL WINAPI GetFileTime(
  的的HANDLE HFILE,
  _Out_opt_ LPFILETIME lpCreationTime,
  _Out_opt_ LPFILETIME lpLastAccessTime,
  _Out_opt_ LPFILETIME lpLastWriteTime
);

BOOL WINAPI GetFileTime( In HANDLE hFile, _Out_opt_ LPFILETIME lpCreationTime, _Out_opt_ LPFILETIME lpLastAccessTime, _Out_opt_ LPFILETIME lpLastWriteTime );

根据Windows的版本,你需要包括(从上面的链接引用)以下内容:

Depending on the version of Windows, you need to include the following (quoting from above link):

FileAPI.h(包括WINDOWS.H); WINBASE.H在Windows Server 2008 R2中,
  Windows 7中,在Windows Server 2008,Windows Vista中,Windows Server 2003中,
  和Windows XP(包括WINDOWS.H)

FileAPI.h (include Windows.h); WinBase.h on Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP (include Windows.h)

我没有一个Windows机器,所以我不能检查这一点,但你应该能够用这些信息来获得上次访问时间。

I don't have a Windows machine so I can't check this, but you should be able to get the "last accessed" time with this information.

如果你真的想知道当一个文件被复制,使用来自Verdasys数码守护者 - HTTP://www.verdasys。 COM 。这是一个企业解决方案,但我从个人的经验,这是正是这一点做得非常好知道。我认为那么数据泄露prevention顶级的解决方案之一。

If you really want to know when a file gets copied, use Digital Guardian from Verdasys - http://www.verdasys.com . It is an "enterprise solution" but I know from personal experience that it is very good at doing exactly this. I consider then one of the top solutions for "data leakage prevention".

这篇关于确定文件在c复制或不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆