Im trying to get Windows version as result in C++. I have tried codes but it gives me wrong versions. Example:
#include<windows.h>
#include<stdio.h>
int main()
{
OSVERSIONINFOEX info;
ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((LPOSVERSIONINFO)&info);//info requires typecasting
printf("Windows version: %u.%u\n", info.dwMajorVersion, info.dwMinorVersion);
}
Output: Windows version: 6.2 Im using Windows 10 and NT 6.2 corresponds to Windows 8/8.1. Im using CodeBlocks, Thanks for your replies.