尝试使用GetFileAttributes获取文件大小 [英] trying to use GetFileAttributes to get file size

查看:166
本文介绍了尝试使用GetFileAttributes获取文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取文件的大小而不打开它.有人告诉我,GetFileAttributes是执行此操作的方法-但是,我在寻找解释方法的过程中遇到了很大的麻烦.有人可以帮忙,还是给我看个替代方案.最主要的是,该方法不会打开文件.

I need to obtain the size of a file without opening it. I have been told that GetFileAttributes is the way to do this - however, I am having great trouble in finding something which explains how. Could somebody help please, or show me an alternative. The main thing is that the method does not open the file.

推荐答案

使用 ^ ],而不是GetFileAttributes.
Use GetFileAttributesEx[^], not GetFileAttributes.


尝试以下方法:

WIN32_FIND_DATA findFileData;
Try this:

WIN32_FIND_DATA findFileData;
memset(&findFileData, 0, sizeof(WIN32_FIND_DATA));

HANDLE hFind = FindFirstFile(lpszFileName, &findFileData);


这篇关于尝试使用GetFileAttributes获取文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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