Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Exception.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cerrno>
4#include <cstring>
5#include <string>
6
7namespace Log {
8// Platform-safe strerror wrapper
9inline std::string GetErrnoMessage()
10{
11#ifdef _MSC_VER
12 std::string buffer(256, '\0');
13 strerror_s(buffer.data(), buffer.size(), errno);
14 buffer.resize(std::strlen(buffer.c_str()));
15 return buffer;
16#else
17 return std::string(strerror(errno));
18#endif
19}
20} // namespace Log
Definition EntityToIDString.hpp:7
std::string GetErrnoMessage()
Definition Exception.hpp:9