_beginthread()没效果呢?
#include <windows.h>
#include <process.h> /* _beginthread, _endthread */
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ofstream out("out.txt");
void ThreadFunc1(PVOID param)
{
while(1)
{
out<<"This was draw by thread l"<<endl;
}
}
void ThreadFunc2(PVOID param)
{
while(1)
{
out<<"This was draw by thread 2"<<endl;
}
}
void ThreadFunc3(PVOID param)
{
while(1)
{
out<<"This was draw by thread 3"<<endl;
}
}
void ThreadFunc4(PVOID param)
{
while(1)
{
out<<"This was draw by thread 4"<<endl;
}
}
int main(int argc, char* argv[])
{
_beginthread(ThreadFunc1,0,NULL);
_beginthread(ThreadFunc2,0,NULL);
_beginthread(ThreadFunc3,0,NULL);
_beginthread(ThreadFunc4,0,NULL);
Sleep(1000);
out<<"end";
return 0;
}
编译都通过了怎么不显示东西呢?