Will Perone

Windows actually provides you a function to resolve GetLastError, WSAGetLastError and other error functions to a textual description of them. I have an implementation of this in my Super Assert Utility

const char *ErrorString(unsigned int ErrorID)
{
	static char errorstr[256];

	FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
                  NULL, ErrorID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
                  errorstr, 256, NULL);
	return errorstr;
}

Now all you need to do to get the corresponding error string is do something like:
string= ErrorString(GetLastError());
MSDN has information on what all of the parameters mean to FormatMessage here
No Comments yet, be the first!
<- for private contact