]> git.tdb.fi Git - libs/core.git/blob - source/core/windows/systemerror.cpp
Use nullptr instead of 0 for pointers
[libs/core.git] / source / core / windows / systemerror.cpp
1 #include <windows.h>
2 #include <msp/strings/lexicalcast.h>
3 #include "systemerror.h"
4
5 using namespace std;
6
7 namespace Msp {
8 string system_error::get_message(int c)
9 {
10         if(c==-1)
11                 c = GetLastError();
12
13         char msg[1024];
14         if(FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, c, 0, msg, sizeof(msg), nullptr))
15                 return msg;
16         else
17                 return lexical_cast<string>(c, Fmt().hex());
18 }
19
20 } // namespace Msp