Click to See Complete Forum and Search --> : How to find the cpu architecture using C++ in Linux?


kcharles
March 21st, 2008, 04:19 AM
i am trying to find the architecture of a processor,i.e x64/x86, using c++. OS is Linux.

i would appreciate any help from u guys..

thanks.

exterminator
March 21st, 2008, 07:01 AM
Is this related to C++? By the way, try the command uname. Check the man pages for the various options. Also, for further CPU info look into /proc/cpuinfo.

kcharles
March 21st, 2008, 07:44 AM
i need to do that thru' some code and moreover i tried that /proc/cpuinfo but it has no information about cpu architecture..

and if you know how to execute a command and get the result using c++ that'll also be very helpful..

thanks for the reply..

exterminator
March 21st, 2008, 07:54 AM
What does uname -all give? I cannot look at the man right now. But see if there is an API that helps with that or you could simply make a system call.