Use stringstream instead of visual studio specific sscanf_s
This commit is contained in:
parent
ea3cc141ff
commit
f11b482576
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -181,7 +182,13 @@ void determineOSVersion()
|
|||||||
DWORD size = sizeof(windows_version_string);
|
DWORD size = sizeof(windows_version_string);
|
||||||
RegQueryValueEx(hKey, "CurrentVersion", 0, 0, (LPBYTE)windows_version_string, &size);
|
RegQueryValueEx(hKey, "CurrentVersion", 0, 0, (LPBYTE)windows_version_string, &size);
|
||||||
unsigned major = 0, minor = 0;
|
unsigned major = 0, minor = 0;
|
||||||
const int ret = sscanf_s(windows_version_string, "%u.%u", &major, &minor);
|
|
||||||
|
std::stringstream sstr(windows_version_string);
|
||||||
|
sstr >> major;
|
||||||
|
if (sstr.peek() == '.')
|
||||||
|
sstr.ignore();
|
||||||
|
sstr >> minor;
|
||||||
|
|
||||||
int windows_version = (major << 8) | minor;
|
int windows_version = (major << 8) | minor;
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user