这段丛书上抄来的代码运行不了,大家帮忙看看
#include <windows.h>
#include <process.h>
#include <stdio.h>
DWORD WINAPI MyThread(void* p)
{
for (int i=0; i < 100; i++)
{
printf("Hello, everybody!\n");
sleep(100);
}
return 0;
}
int main(int argc, char* argv[])
{
HANDLE handle;
DWORD dw;
handle=CreateThread(NULL, 0, MyThread, NULL, 0, &dw);
sleep(100);
for (int i=0; i < 10; i++)
{
print("**********now,Suspended!*******\n");
SuspendThread(handle);
for (int j=0; j < 3; j++)
{
printf("Good Thank you !\n");
sleep(300);
}
printf("*****Now Resumed!********\n");
ResumeThread(handle);
sleep(300);
}
CloseHandle(handle);
return 0;
}