c判断windows的系统是32位还是64位

来源:互联网 发布:js array empty 编辑:程序博客网 时间:2024/04/29 06:16
#include <windows.h>#include <stdio.h>#pragma comment(lib, "user32.lib")int main(int argc, char *argv[]){    SYSTEM_INFO si;    // Copy the hardware information to the SYSTEM_INFO structure.    GetNativeSystemInfo(&si);    // Display the contents of the SYSTEM_INFO structure.    printf("si.wProcessorArchitecture = %d\nPROCESSOR_ARCHITECTURE_AMD64 = %d\nPROCESSOR_ARCHITECTURE_IA64 = %d\n",        si.wProcessorArchitecture, PROCESSOR_ARCHITECTURE_AMD64, PROCESSOR_ARCHITECTURE_IA64);    if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)    {        printf("64-bit os\n");    }    else{        printf("32-bit os\n");    }    getchar();    return 0;}
0 0
原创粉丝点击