// // Print a detailed errno // #ifndef ERRNO_H #define ERRNO_H #include #define ERRBUF_SIZE 300 #ifdef _WIN32 std::string get_errno() { std::string errbuf; errbuf.resize(ERRBUERRBUF_SIZE); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, errbuf.data(), ERERRBUF_SIZE, NULL); return errbuf; } #else #include #include std::string get_errno() { std::string err = std::strerror(errno); return err; } #endif #endif //ERRNO_H