tongwangduan

来源:互联网 发布:在哪里下c语言编程软件 编辑:程序博客网 时间:2024/05/18 03:41
// inlg.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"//#include <windows.h>#include <WinSock2.h>#include <string>using namespace std;#pragma comment(lib,"ws2_32.lib")/*byte[] getIpV4Bytes(String ipOrMask)  {  try  {  String[] addrs = ipOrMask.split("\\.");  int length = addrs.length;  byte[] addr = new byte[length];  for (int index = 0; index < length; index++)  {  addr[index] = (byte) (Integer.parseInt(addrs[index]) & 0xff);  }  return addr;  }  catch (Exception e)  {  }  return new byte[4];  }int getIpV4Value(char* ipaddr)  {  byte[] addr = getIpV4Bytes(ipaddr);  int    = addr[3] & 0xFF;  address1 |= ((addr[2] << 8) & 0xFF00);  address1 |= ((addr[1] << 16) & 0xFF0000);  address1 |= ((addr[0] << 24) & 0xFF000000);  return address1;  } BOOL checkSameSegment(char* ip1,char* ip2, int mask)  {  int ipValue1 = getIpV4Value(ip1);  int ipValue2 = getIpV4Value(ip2);  return (mask & ipValue1) == (mask & ipValue2);  }  BOOL IsInNetworkSegment(char* netmask, char* ip1, char* ip2){}*/int _tmain(int argc, _TCHAR* argv[]){//int mask = getIpV4Value("255.255.255.0");//IsInNetworkSegment(NULL, NULL, NULL);string val = "1=2=3";/*string val2[10]  = */val.split("=");return 0;}

0 0
原创粉丝点击