#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
char buffer[20];
size_t environmentVariableValueStringLength;
getenv_s(&environmentVariableValueStringLength, buffer,
sizeof(buffer) - 1, "OS");
cout << buffer << endl;
return 0;
}
// Output: Windows_NT
Reference: http://en.cppreference.com/w/c/program/getenv
Monday, December 4, 2017
C++17(C11): Bounds-checking getenv_s()
C++17 added the bounds-checking function getenv_s().
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment