CppCommon  1.0.4.1
C++ Common Library
system_environment.cpp

Environment management example

#include <iostream>
int main(int argc, char** argv)
{
std::cout << "32-bit OS: " << (CppCommon::Environment::Is32BitOS() ? "true" : "false") << std::endl;
std::cout << "64-bit OS: " << (CppCommon::Environment::Is64BitOS() ? "true" : "false") << std::endl;
std::cout << "32-bit process: " << (CppCommon::Environment::Is32BitProcess() ? "true" : "false") << std::endl;
std::cout << "64-bit process: " << (CppCommon::Environment::Is64BitProcess() ? "true" : "false") << std::endl;
std::cout << "Debug build: " << (CppCommon::Environment::IsDebug() ? "true" : "false") << std::endl;
std::cout << "Release build: " << (CppCommon::Environment::IsRelease() ? "true" : "false") << std::endl;
std::cout << "Big endian system: " << (CppCommon::Environment::IsBigEndian() ? "true" : "false") << std::endl;
std::cout << "Little endian system: " << (CppCommon::Environment::IsLittleEndian() ? "true" : "false") << std::endl;
std::cout << "OS version: " << CppCommon::Environment::OSVersion() << std::endl;
std::cout << std::endl << "Environment variables: " << std::endl;
for (const auto& envar : CppCommon::Environment::envars())
std::cout << envar.first << "=" << envar.second << std::endl;
return 0;
}
static bool IsBigEndian()
Is big-endian system?
static bool Is64BitProcess()
Is 64-bit running process?
Definition: environment.cpp:70
static bool Is64BitOS()
Is 64-bit OS?
Definition: environment.cpp:46
static bool Is32BitProcess()
Is 32-bit running process?
Definition: environment.cpp:65
static bool IsRelease()
Is compiled in release mode?
Definition: environment.cpp:94
static std::map< std::string, std::string > envars()
Get all environment variables.
static bool IsDebug()
Is compiled in debug mode?
Definition: environment.cpp:89
static std::string OSVersion()
Get OS version string.
static bool Is32BitOS()
Is 32-bit OS?
Definition: environment.cpp:41
static bool IsLittleEndian()
Is little-endian system?
Environment management definition.