#include <string.h>
#include <stdio.h>
int main( int argc, char** argv )
{
/** 字符串转数字 */
char* str = "123456";
/** atol is ascii to long.
* atof is ascii to float.
*/
long num = atol(str);
printf("String %s trans to number %ld.\n",str, num);
return 0;
}
温馨提示:答案为网友推荐,仅供参考