.. _program_listing_file_Utilities_SystemInfo.h: Program Listing for File SystemInfo.h ===================================== |exhale_lsh| :ref:`Return to documentation for file ` (``Utilities/SystemInfo.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef __SystemInfo_h__ #define __SystemInfo_h__ #include "SPlisHSPlasH/Common.h" #if WIN32 #define NOMINMAX #include "windows.h" #else #include #include #endif namespace Utilities { class SystemInfo { public: static std::string getHostName() { #ifdef WIN32 const unsigned int bufferSize = 32767; TCHAR *infoBuf = new TCHAR[bufferSize]; DWORD bufCharCount = bufferSize; if (!GetComputerName(infoBuf, &bufCharCount)) return ""; std::string name = infoBuf; delete[] infoBuf; return name; #else const unsigned int bufferSize = 32767; char hostname[bufferSize]; gethostname(hostname, bufferSize); return hostname; #endif } }; } #endif