high order-low order是什么意思?

liefeng999 2009-03-27 10:46:08

在GetFilesize的remark中有如下一段
If the function succeeds, the return value is the low-order doubleword of the file size, and, if lpFileSizeHigh is non-NULL, the function puts the high-order doubleword of the file size into the variable pointed to by that parameter.

If the function fails and lpFileSizeHigh is NULL, the return value is INVALID_FILE_SIZE. To get extended error information, call GetLastError.

If the function fails and lpFileSizeHigh is non-NULL, the return value is INVALID_FILE_SIZE and GetLastError will return a value other than NO_ERROR.
就不知这low-order doubleword和low-order word分别是什么意思?
...全文
1656 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
zotin 2010-08-24
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 liefeng999 的回复:]

有确定的文档吗,因为我的文件很大,有10M左右,不知行不行。
[/Quote]

low-order是文件大小低位的两个双字。4个G以下的文件都可以表示。
所以像10M这样的文件,其实对这个函数来说,很小,只用low-order就可以了。所以只用GetFilesize的返回值就够了。
当然如果你的文件有可能超过4个G,那还是应该判断一下hi-order的。
kuangsun 2010-08-12
  • 打赏
  • 举报
回复
学习了!
gaowei123456789 2009-04-03
  • 打赏
  • 举报
回复
文件大小是个很大的数,长度由2个double word组成,
low-order double word就是最右一个double word(或处在低位的double word)
而high-order double word就是最左那个double word(或处在高位的double word)
warsong 2009-04-03
  • 打赏
  • 举报
回复
前面的兄弟已经回答清楚了,GetFileSize的返回值是DWORD类型,它是windwos定义的数据类型,一般是32位bit数据(你可以在msdn中查到)。
举个例子:16进制数“0X005B0B70”(就是10进制的5966704)就是一个DWORD数(如果转换为二进制,它有32位),他的low-order(低位2字节)是“0X0B70”(就是10进制的2928);他的high-order(高位2字节)是“0X005B”(就是10进制的91)。可以使用windows定义的宏LOWORD和HIWORD来获取DWORD数的low-order和high-order。
warsong 2009-04-03
  • 打赏
  • 举报
回复
补充一下关于GetFilesize这个函数的看法(在网上找到的对msdn翻译):
返回值
如果函数调用成功,返回值为文件大小的低端(第0-31位)的值,如果 lpFileSizeHigh 参数不为 NULL ,该参数对应的变量包含文件大小的高端(第32-63位)部分的值。 。。
我写的代码是:
TCHAR * lpcTheFile = "D:\\filename"; //你要获得其大小的文件名称
HANDLE hFile = CreateFile(lpcTheFile,
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
DWORD dwFileSize,dwFS;
dwFileSize = GetFileSize(hFile, &dwFS);
cout<<dwFS<<" "<<dwFileSize<<endl;
如果文件小于4GB,那么其大小可以用DWORD的值来表示,就可以不用dwFS。比如我的一个2.54G的文件的大小就是“0 A2EA6000”(dwFS为0);如果文件大于4GB,就必须使用dwFS了。比如我的一个6.43G的文件的大小就是“1 9BF7312C”(dwFS为1)。

比较有趣的是在MSDN 2005上关于GetFileSize函数有这么一段说明:“The file size that can be reported by this function is limited to a DWORD value.To retrieve a file size that is larger than a DWORD value, use the GetFileSizeEx function.” 就是说当文件大小不能用一个DWORD value表示(超过4G)时就要用GetFileSizeEx。但它又说 “If the function succeeds, the return value is the low-order doubleword of the file size, and, if lpFileSizeHigh is non-NULL, the function puts the high-order doubleword of the file size into the variable pointed to by that parameter.”我实在是搞不懂M$的想法了。。。。。ORZ
liefeng999 2009-03-27
  • 打赏
  • 举报
回复
有确定的文档吗,因为我的文件很大,有10M左右,不知行不行。
anybbs 2009-03-27
  • 打赏
  • 举报
回复
文件大小是个很大的数,长度由2个double word组成,
low-order double word就是最右一个double word(或处在低位的double word)
而high-order double word就是最左那个double word(或处在高位的double word)
Paradin 2009-03-27
  • 打赏
  • 举报
回复
low-order:DWORD低位2字节
high-order:高位2字节

69,375

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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