VC 2003 版本,UNICODE 编译,居然不支持 wsprintf( buf,_T(“%2.1f”),fValue ) 浮点数格式化?!
由于是 API 函数,估计其它版本的编译器可能也会有问题。
posted on 2007-10-07 03:06 杨老师的茅屋 阅读(1779)
评论(8) 编辑 收藏
评论
-
# re: 偶然发现了一个 VC2003 的BUG
Posted @ 2007-10-07 19:22
这是WINAPI的BUG,不是vc2003的bug吧。
-
# re: 偶然发现了一个 VC2003 的BUG
Posted @ 2007-10-07 19:34
估计也不叫BUG,他压根没想实现这个功能。
-
# re: 偶然发现了一个 VC2003 的BUG
Posted @ 2007-10-08 10:00
看文档先
-
# re: 偶然发现了一个 VC2003 的BUG
Posted @ 2007-10-08 10:04
MSDN中并没有说其支持 f
type Output the corresponding argument as a character, a string, or a number. This field can be any of the following values.
Value Meaning
c Single character. This value is interpreted as type WCHAR if the calling application defines UNICODE and as type CHAR otherwise.
C Single character. This value is interpreted as type CHAR if the calling application defines UNICODE and as type WCHAR otherwise.
d Signed decimal integer. This value is equivalent to i.
hc, hC Single character. The wsprintf function ignores character arguments with a numeric value of zero. This value is always interpreted as type CHAR, even when the calling application defines UNICODE.
hd Signed short integer argument.
hs, hS String. This value is always interpreted as type LPSTR, even when the calling application defines UNICODE.
hu Unsigned short integer.
i Signed decimal integer. This value is equivalent to d.
lc, lC Single character. The wsprintf function ignores character arguments with a numeric value of zero. This value is always interpreted as type WCHAR, even when the calling application does not define UNICODE.
ld Long signed integer. This value is equivalent to li.
li Long signed integer. This value is equivalent to ld.
ls, lS String. This value is always interpreted as type LPWSTR, even when the calling application does not define UNICODE. This value is equivalent to ws.
lu Long unsigned integer.
lx, lX Long unsigned hexadecimal integer in lowercase or uppercase.
p Windows 2000/XP: Pointer. The address is printed using hexadecimal.
s String. This value is interpreted as type LPWSTR when the calling application defines UNICODE and as type LPSTR otherwise.
S String. This value is interpreted as type LPSTR when the calling application defines UNICODE and as type LPWSTR otherwise.
u Unsigned integer argument.
x, X Unsigned hexadecimal integer in lowercase or uppercase.
-
# re: 偶然发现了一个 VC2003 的BUG
Posted @ 2007-10-09 16:43
不会吧
-
# re: 偶然发现了一个 VC2003 的BUG
Posted @ 2007-10-09 20:57
恭喜你,可以去领奖了。
-
# re: 偶然发现了一个 VC2003 的BUG
Posted @ 2007-11-06 09:20
杨老师,请问能告诉我,您的邮件地址吗?有问题想向您请教!
-
# re: 偶然发现了一个 VC2003 的BUG
Posted @ 2008-10-03 15:33
wsprintf没有实现对浮点的格式化
得用swprintf,这个可以实现对浮点的格式化
比如:swprintf(cs, _T("%f"), dlg.m_value); // m_value为浮点型
哈哈,两个字符之差,几乎一样
希望有帮助!
e-mail: zhongkan@163.com