{I+=codeWee;} |
#include <process.h> #include <stdio.h> UINT __stdcall ThreadFunc(void* pParam) { bool isLoop = true; int* nResult = (int*)pParam; int n = 0; while (isLoop) { if (n > 100) _endthreadex(1); *nResult += n; n++; } return 1; } void main() { int nResult = 0; HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, &ThreadFunc, &nResult, 0, NULL); WaitForSingleObject(hThread, INFINITE); printf("%d", nResult); getchar(); }