我要被sprintf搞疯了,救救我吧
我的PAL工程没法进行了sprintf没法用:
请看测试代码:
int AddIn_main(int isAppli, unsigned short OptionNum)
{
unsigned int r;
char szht;
sprintf (szht,"%d",-1);
PrintMini(1,1,szht,MINI_OVER);
GetKey(&r);
Init_char ();
//while (1){r = ShowTitle();if (r==0) break;else if (r==2) return 1;
do{
GetMap(G_char.map_id);
r = RunMap();
if (r==RUN_EXIT_GAME)
{
break;
}
}while (1);
return 1;
}
我实在没办法了,这个sprintf总是出错。
本来应该打印-1的,可是出来却成了“ CE”(这个E还是工程符号[特殊字符])
我把szht的声明又改成char szht;
结果又成了“G≤”!(G还是工程符号)
我索性改成char szht;结果程序炸了(你懂的,就是一个大对话框,上面写着System ERROR)
谁能帮帮我…… 表示不懂C语言…… 您这是一部分代码吧, 我没法试 将第五行的szht改为szht试一试,我觉得szht相当于指针,而szht才是内容。 将第五行的szht改为szht试一试,我觉得szht相当于指针,而szht才是内容。
zhj6408 发表于 2011-2-8 21:16 http://www.cncalc.org/images/common/back.gifsprintf的第一个参数就是指针 自己写sprintf?
工程量大了点... 不懂C语言 只会BASIC 8# wtof1996
我也是 PAL工程?!PAL不是电视传输制式吗? pal是仙剑的简称 1.你这个如果是在9860下的话是无法编译通过的,GetKey函数定义如下:
int GetKey(
unsigned int *keycode// pointer to key code
);
注意 这里是指针。
2.你需要的只不过是# include <stdio.h>
页:
[1]