blob: 6810fcd6735b1c9c56caec019fd03aa8fa5c82ac [file] [log] [blame]
#pragma once
#include <unistd.h>
#include <array>
#include <climits>
#include <string>
inline std::string getHostName()
{
std::string hostName;
std::array<char, HOST_NAME_MAX> hostNameCStr{};
if (gethostname(hostNameCStr.data(), hostNameCStr.size()) == 0)
{
hostName = hostNameCStr.data();
}
return hostName;
}