Threads are insanely easy..
[snip_from_other_one_of_my_posts]Code:#include <process.h> #include <windows.h> #include <conio.h> #include <iostream> using namespace std; bool flag=false; void DoSomething(PVOID) { while(!kbhit()); flag = true; } int main(void) { _beginthread(DoSomething, 0, NULL); while(!flag) cout<<"Threads..."<<endl; return 0; }
You're going to need to enable Mutli-Threading for this to work...
In MSVC (Visual Studio), go to Project->Settings->Click the C++ tab. Change the "Category" dropdown box to "Code Generation", and then change the "Use run-time library" dropdown box to "Multithreaded" or "Debug Mutithreaded".[/snip]



LinkBack URL
About LinkBacks


