标签:cpp 信息 min entry ber console define sizeof size
Windows 提供了GetVersionEx 函数来返回当前操作系统的版本信息 #include "stdafx.h" #include "windows.h" #include "iostream.h" int main(int argc, char* argv[]) { OSVERSIONINFO os={sizeof(os)}; GetVersionEx(&os); cout<<os.dwBuildNumber<<endl; cout<<os.dwMajorVersion<<endl; cout<<os.dwMinorVersion<<endl; cout<<os.dwOSVersionInfoSize<<endl; cout<<os.dwPlatformId<<endl; cout<<os.szCSDVersion<<endl; return 0; } ************************************** // 1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "windows.h" #include "iostream.h" int main(int argc, char* argv[]) { OSVERSIONINFO os={sizeof(os)}; GetVersionEx(&os); // cout<<os.dwBuildNumber<<endl; // cout<<os.dwMajorVersion<<endl; // cout<<os.dwMinorVersion<<endl; // cout<<os.dwOSVersionInfoSize<<endl; // cout<<os.dwPlatformId<<endl; // cout<<os.szCSDVersion<<endl; if(os.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS) cout<<"是windows98系列的操作系统"<<endl; else cout<<"是windowsNT系列的操作系统"<<endl; return 0; }
标签:cpp 信息 min entry ber console define sizeof size
原文地址:https://www.cnblogs.com/butchert/p/12550029.html