首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

为啥上面的代码wsprintf对数字歧视呢

2012-09-24 
为啥下面的代码wsprintf对数字歧视呢// wsprintf.cpp : Defines the entry point for the application.//#

为啥下面的代码wsprintf对数字歧视呢
// wsprintf.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "stdio.h"

int APIENTRY WinMain(HINSTANCE hInstance,
  HINSTANCE hPrevInstance,
  LPSTR lpCmdLine,
  int nCmdShow)
{
 // TODO: Place code here.
  TCHAR szBufferx [100] ;
long length;

//length=wsprintf (szBufferx, TEXT ("%5d"),123456789);//这句输出是对的
length=wsprintf (szBufferx, TEXT ("%5d"),13023289560);
//为什么上面这句输出来的值不对呢?
MessageBox (NULL, szBufferx, "szCaption", 0|1) ;
return 0;
}





[解决办法]
应该是溢出了啊
[解决办法]
13023289560超了整数范围了吧。

[解决办法]
length=wsprintf (szBufferx, TEXT ("%I64"),13023289560);
好像是这么写吧,,楼主试试
[解决办法]
那个位数太长了,他搞不定了。
[解决办法]
13023289560超出32位整型数范围了
[解决办法]
win32平台下:
类型 范围
int : –2,147,483,648 to 2,147,483,647 
long : –2,147,483,648 to 2,147,483,647 

热点排行