windows下获取文件大小
我找到了这个函数 GetFileSizeEx(),它返回由结构体并集形成的 PLARGE_INTEGER 格式的文件大小。
typedef union _LARGE_INTEGER {
struct {
DWORD LowPart;
LONG HighPart;
} ;
struct {
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
这和我称之为结构的结构一样吗?如何计算它返回的文件大小以及它可以处理多大的信息?
I have found this function GetFileSizeEx(), which returns the size of file in PLARGE_INTEGER that is formed by the union of structures.
typedef union _LARGE_INTEGER {
struct {
DWORD LowPart;
LONG HighPart;
} ;
struct {
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
Is it same as if I'd call it structure of structures? How can I figure the file size that it has returned and how large information can it handle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能误解了
union
是什么。文件的长度可以通过以下方式获取:或者,您可以使用现代编译器直接访问 64 位表示形式:
You are probably misunderstanding what a
union
is. A file's length is obtained byAlternatively, you can access the 64 bit representation directly with modern compilers:
不,联合不是结构的结构。
我建议您阅读这个问题和答案:结构和结构之间的区别C 中的 Union
希望这有助于澄清:)
no a union is NOT a struct of structs.
I suggest you read this question and answers: Difference between a Structure and a Union in C
hope this helps to clarify :)