我想做這個簡單的代碼工作。傳遞函數C++中的指針
#include <iostream>
#include <windows.h>
void printSome (int i)
{
std::cout << i << std::endl;
}
void spawnThread (void (*threadName)(int i))
{
CreateThread
(
0, // default security attributes
0, // use default stack size
(LPTHREAD_START_ROUTINE)threadName, // thread function name
(LPVOID)i, // argument to thread function
0, // use default creation flags
0 // returns the thread identifier
);
}
int main()
{
spawnThread(printSome(155));
}
我在windows上,使用vs任何幫助將大大appriciated。
那究竟是什麼問題呢? – Brian 2008-12-31 17:30:50