Created
August 22, 2012 09:27
-
-
Save Neferetheka/3424009 to your computer and use it in GitHub Desktop.
Display last C++ error in Visual Studio output console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DWORD dw = GetLastError(); | |
char *TextSize; | |
std::printf("Error has occured: "); | |
FormatMessage(0x00000100 | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, | |
dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | |
(LPTSTR) &TextSize, 0, 0); | |
OutputDebugString((LPCWSTR)TextSize); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment