Even in a managed world like .Net sometimes you gotta know where you’re actually running in – 32-bit or 64-bit. But how do you figure out where you at?
Well, In an 64-bit OS all pointers are 8 bits wide, so just check for the size of your pointers!
if ( IntPtr.Size == 8 ) { // 64 bit machine }} else if ( IntPtr.Size == 4 ) { // 32 bit machine }}