检查字符串是不是整数的函数(C语言)
/* to see whether this string is a positive integer */ int check_str_isint(char *psrc) { int num; char *p; p = psrc; num = 0; while((*p) != '\0') { if((*p) >= '0' && (*p) <= '9') { num *= 10; num += (*p) - '0'; p++; continue; } return 0;/* the string contains char not belongs to 0-9 */ } return 1; //return num; }

浙公网安备 33010602011771号