|
//返回1正确,返回0不是
以为是判断端口的,数字范围设在了1-65535
一下是函数代码:
[cpp] //返回1正确,返回0错误 int isRight(CString str) { www.2cto.com BOOL bIsDigit = TRUE; int nCount = str.GetLength(); // 获得字符个数 for ( int i = 0; i < nCount; i ++ ) { if ( 0 == isdigit( str.GetAt(i) ) ) // 不是数字就置标志位 { return 0; } } int temp = atoi(str); if (temp>0 && temp < 65536) { return 1; } return 0; }
|