tongwangduan

// 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;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章