]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/except.cpp
Remove an obsolete Makefile
[libs/core.git] / source / core / except.cpp
index 7ac634d9a30c9ef9c8f8dec01633b5c950c96ef8..ddd2cb5167d57f0e3f5df614a8caf3ad3b68dc50 100644 (file)
@@ -7,6 +7,9 @@ Distributed under the LGPL
 
 #include <sstream>
 #include <cstring>
+#ifdef WIN32
+#include <windows.h>
+#endif
 #include "except.h"
 
 using namespace std;
@@ -36,7 +39,11 @@ string SystemError::build_what(const string &w, int e)
        ostringstream buf;
        buf<<w<<": ";
 #ifdef WIN32
-       buf<<e;
+       char msg[1024];
+       if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, e, 0, msg, sizeof(msg), 0))
+               buf<<msg;
+       else
+               buf<<e;
 #else
        buf<<strerror(e);
 #endif