参考:http://blog.csdn.net/morewindows/article/details/7421759
http://www.voidcn.com/blog/junbopengpeng/article/p-4650944.html
#undef UNICODE
//#define WIN32_LEAN_AND_MEAN
#include "stdafx.h"
#include <string>
#include <vector>
//#include <boost/algorithm/string/classification.hpp>
//#include <boost/algorithm/string/split.hpp>
#include <iostream>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <iphlpapi.h>
#include <stdio.h>
#define DEFAULT_PORT "27015"
#define INTERNET_PORT "27014"
#define DEFAULT_BUFLEN 10024
#pragma comment(lib, "Ws2_32.lib")
using namespace std;
typedef struct my {
int a;
int b;
}my_s;
DWORD WINAPI myfuc(LPVOID aa)
{
my_s a = *(my_s*)aa;
printf("hello%d %d\n", a.a, a.b);
return 0;
}
int main(void)
{
my_s s[10];
for (int i = 0; i < 10; i++) {
//my_s s
s[i].a = i;
s[i].b = i;
HANDLE hand = CreateThread(NULL, 0, myfuc, &(s[i]), 0, NULL);
}
while (true);
return 0;
}