请问怎样把 char 转换成 int ?
我忘了 问题点数:5、回复次数:10Top
1 楼panda_w(好想睡啊!)回复于 2001-04-20 09:22:00 得分 1
atoiTop
2 楼wzg_harbin(/*0xFA*/)回复于 2001-04-20 09:24:00 得分 0
strtol可以啊Top
3 楼superspirit(该上进的猪)回复于 2001-04-20 09:29:00 得分 0
using the function at following:
int atoi( const char *string )
Example:
#include <stdio.h>
#include <stdlib.h>
void main(void)
{
char string[5]="5460";
int num=0;
num=atoi(string);
printf("The number= %d",num);
return;
}
if you run it, the 5460 will show on you pc screen!
Now ,you understand? I thank so!Top
4 楼wzg_harbin(/*0xFA*/)回复于 2001-04-20 09:35:00 得分 0
还有atoiTop
5 楼xfile75(zhanggp)回复于 2001-04-20 09:57:00 得分 0
atoiTop
6 楼alamb(把握今生)回复于 2001-04-20 10:42:00 得分 0
还有一种方法,用sscanf,功能大大的说Top
7 楼ttyp(@http://www.cnblogs.com/ttyp/)回复于 2001-04-20 10:54:00 得分 0
atoiTop
8 楼wildinghorse(中央突击师)回复于 2001-04-20 10:59:00 得分 4
这个问题太菜了,哈哈
Top
9 楼nne998(☆☆☆☆☆☆☆伴月)回复于 2001-04-20 17:10:00 得分 0
是啊,这个问题太菜了------没办法,我忘了,菜也要问啦(用了 delphi 一个月, 什么都搞乱啦,猛找 strtoint ,却忘了 atoi、atof、_itoa、 .... 哈哈)Top
10 楼Phourm()回复于 2001-04-20 17:35:00 得分 0
sscanf(ch,"%d",&a);Top




