64位整形的格式化 Topic is solved

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
liuqi5521
Earned some good credits
Earned some good credits
Posts: 103
Joined: Thu Apr 03, 2008 5:35 am
Location: China
Contact:

64位整形的格式化

Post by liuqi5521 » Fri Aug 15, 2008 12:12 am

代码如下:
unsigned long long ull=0x7fffffffffffffffULL;
s=wxString::Format("%llu",ull);
MessageBox(0,s,s,MB_OK);

运行结果出来,却超不过4GB,这是什么原因呢?

Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil » Sat Aug 16, 2008 1:46 am

不太明白为什么,不过,如果和我猜测的一样,楼主想将文件大小转换成"4GB"这样的字符串,建议楼主看看:

wxULongLong wxFileName::GetSize(const wxString& filename)



wxString wxFileName::GetHumanReadableSize(const wxULongLong& bytes, const wxString& nullsize = "Not available", int precision = 1)

http://docs.wxwidgets.org/stable/wx_wxf ... amegetsize

以及

wxLongLong(http://docs.wxwidgets.org/stable/wx_wxlonglong.html)。

-Utensil
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/

Post Reply