windows开发各种细节.....

我发现windows自己的API一般不能做到与windows自己的历史兼容。很神奇...

下面几个函数都前后不兼容.

例如GetFileTime这个函数。本来是得到文件的读写时间。但是因为windows自己很有趣,自己的的读写时间其实并不是用户真正的读写时间。当然可能人家考虑了效率等其他的问题。下面一段是摘抄自MSDN中的介绍:

Not all file systems can record creation and last access times and not all file systems record them in the same manner. For example, on FAT, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution of 1 day (really, the access date). Therefore, the GetFileTime function may not return the same file time information set using SetFileTime. NTFS delays updates to the last access time for a file by up to one hour after the last access.

不是所有的文件系统都能记录创建时间和最后的访问时间。也不是所有的文件系统都以相同的方式记录他们。比如在FAT上,创建时间误差是10微秒,写时间的误差2秒,访问时间的误差是1天!(...我觉得hacker可以在这个一天上做些手脚..)因此,就是你使用SetFileTime这个函数,GetFileTime也不可能会返回相同的时间...NTFS会延迟一小时更新最后的访问时间...

真是无语呀..

FindNextFile这个函数有些小问题,就是不能以字母序返回文件...在FAT和在NTFS系统上的表现不一样...大概的原因在于那个文件描述表中存放顺序是不一样的.FAT是使用的时间顺序存放,而NTFS是使用的按字母序存放。这个FindNextFile根本没有做啥事情,直接读出来..这个API就是仅仅追求效率...顺便一提..它其实应该再开发一个API叫做FindSortedNextFile...这样更好些..不过我想它也不能做..解决途径..上层排个序先。

The order in which this function returns the file names is dependent on the file system type. With the NTFS file system and CDFS file systems, the names are returned in alphabetical order. With FAT file systems, the names are returned in the order the files were written to the disk, which may or may not be in alphabetical order.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值