I have some multi threaded code that makes one thread per core except I'm having troubles working out how to get the core count under windows.
For linux i have:
//from http://www.cplusplus.com/forum/unices/6544/
FILE * fp;
char res[128] = {0};
fp = popen("/bin/cat /proc/cpuinfo |grep -c '^processor'","r");
fread(res, 1, sizeof(res)-1, fp);
fclose(fp);
if (res)
return atoi(res);
return 0;
but I can't find a way that works under windows. Whats the best way of getting the count under windows?