一個很是簡潔有效的判斷IP地址格式是否正確的函數,c++代碼

BOOL isIpFormatRight(LPTSTR ipAddress) {//判斷IP地址是否合法 int a,b,c,d; if ((swscanf(ipAddress,L"%d.%d.%d.%d",&a,&b,&c,&d)==4) &&(a>=0&&a<=255) &&(b>=0&&b<=255) &&(c>=0&&c<=255) &&(d>=0&&d<=255)) { return T
相關文章
相關標籤/搜索