0

There are tons of questions regarding this issue on stack overflow, still couldn't find a simple function to get windows name along with its version.

This is what I need

std::string OS = getOsName();
std::cout << OS << std::endl;

output:

Windows 10.0

I'm not interested in the build version or minor versions at all

imli
  • 13
  • 4
  • https://stackoverflow.com/questions/142508/how-do-i-check-os-with-a-preprocessor-directive – kiner_shah May 26 '22 at 05:45
  • 1
    Perhaps the example code on this page will help: https://www.arclab.com/en/kb/cppmfc/get-windows-version-from-registry.html – Jeremy Friesner May 26 '22 at 06:29
  • @kiner_shah: Isn't that QA about determining what kind and version of target OS a programed is currently being compiled for. That's not the same as figuring out the system environment at runtime. – datenwolf May 26 '22 at 07:20
  • @datenwolf, ohh yeah, you are right, my bad! – kiner_shah May 26 '22 at 10:43

0 Answers0