分类:
2008-11-02 20:58:22
可以使用sprintf,例子如下:
#include
int main()
{
int i = 1234;
float j = 3.1415926;
char strNum[128] = {0};
sprintf(strNum,"%d",i);
printf("i = %s\n",strNum);
sprintf(strNum,"%f",j);
printf("i = %s\n",strNum);
return 0;
}
strNum的大小要适当,不要越界了!