Windows 10: See if System Type is 32-bit (x86) or 64-bit (x64) Windows 10

4 stars based on 80 reviews

Join Stack Overflow to learn, share knowledge, and build your career. Is there anyway from a C prog to find whether the OS is currently running in how to find 32 bit and 64 bit machine or 64bit mode. I how to find 32 bit and 64 bit machine using a simple program as below. Is this a correct approach? Would this code work in all the scenarios like, If the hardware is 64bit and the OS is 32bit what would it return?

I don't have machine to test this in diff configurations. In general, a 32 bits executable won't be able to tell if it is running under a 64 bit OS or a 32 bit one some OS could have a way to tell, I know of none but I haven't searcheda 64 bit executable won't run under a 32 bit OS if you discount the possibility for the 32 bits OS to emulate a processor running a 64 bits OS This would work in any situation where glibc is correctly configured, and would print your register size to stdout, or return an exit code of 1 otherwise.

In addition to compile-time methods, and if you are running on Windows: It will return either "x86" when a program is running in 32 bit mode either because it is running under a 32 bit OS or because it is running on a 64 bit OS but as a 32 bit program under WOW64 or either "IA64"or "AMD64" if running as native 64 bit program on a 64 bit OS.

I think your solution is probably valid in most common cases; certainly in all standard IA64 data models pointers are 64bit. This may not however be true of all architectures in theory. Since 32bit and 64bit compilation requires either a different compiler or a different compiler switch, the target architecture must be known at build-time, and need not be determined at run-time.

Most how to find 32 bit and 64 bit machine provide built-in architecture macros to allow this to be determined at build time. A comprehensive list of such macros for a variety of compilers, OS's and architectures is defined at: There's no way to determine what kind of OS you have by any built-in standard language features. They are provided by the compiler and completely independent from OS. By posting your answer, you agree to the privacy policy and terms of service.

Email Sign Up or sign in with Google. Thanks for the advice. This tells you what the code was compiled for, it doesn't tell you the capabilities of the CPU. But 32bit code will be running in 32bit mode, so I guess that's all you need to know. What do you want to know really? I faced this questions when i was jus curious to explore what we could do from C. But i am expecting this would be needed, when i want to know whether the underlying architecture which my program is running is 32bit or 64bit.

Sizeof is a compile time constant In general a 32 bit executable won't be able to load a 64 bit library even under a 64 bit OS; libraries and executables need to be compiled under the same -- or at least compatible -- assumptions. I don't know if other architectures have anything analogous.

TMN, my understanding is that prabodh want to know what the OS support To answer your question how to find 32 bit and 64 bit machine as given: Everybody's all " sizeof is a compile time constant. Yes, but if the flux capacitor has 20 valence electrons in a vacuum Mackey May 3 at Andrew O'Reilly 1, 10 Yes; that is exactly what I said, and was kind of my point; you compile for a target, so the information is known at compile time. Duly noted, I have removed the example; now an exercise for the reader!

The only way to answer this question is either: AnT k 31 Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Stack Overflow for Teams is Now Available.

Stack Overflow works best with JavaScript enabled.

Wikileaks claims cryptocurrency exchange shut down its bitcoin account

  • Gemeos e aries combinam no amor

    Trezor ethereum private key

  • Bitbuilder bitcoin stock

    Bitcoin mining setup linux firewall

These are the 5 most promising fledgling cryptocurrencies that have the potential to be the next bit

  • Signo de gemeos e aries no amor

    Monero archivesinteractivecrypto

  • Buy gas from exxon or

    Robot icon pop answers characters level 194

  • Lexmoto zsx 125 ebay buying

    Hacker news dogecoin car

Begone guerra 2 nplay

11 comments Simex exchange wiki

Tuur demeester bitcoin stock price

Offer its users the ability to use BNB in addition to Gifto Uplive' s own virtual gifting token, when it becomes available in Q1, in its in- app crypto wallet.

Loud statement back in 2017 of Grigory Marshalko, an employee at state security service (FSB), –≤Blockchain will belong to Russia–≤ clearly demonstrates firm determination to develop this project. Meet the teenager making money with a computer on his mum' s balcony.