+ {
+#ifdef WIN32
+ DWORD err = GetLastError();
+ if (err)
+ {
+ strcat(buf, " [");
+ FormatMessage(
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ err,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) buf + strlen(buf),
+ 2048,
+ NULL);
+ strcat(buf, "]");
+ }
+#else
+ sprintf(buf + strlen(buf), " [%s]", strerror(errno));
+#endif
+ }