|
DWORD ErrCode = GetLastError(); printf("failed: GetLastError returned %u\n", ErrCode); |
|
|
|
ASN1 遇到了不正确的标记值
可以用vc自带的error lookup工具察看错误码的含义 |
|
|
vc -> tools -> error lookup -> 输入你得到的error返回值
我查了一下你这个error对应得错误信息是 ASN1 遇到了不正确的标记值 |
|
|
那有没有能查看相应的错误信息的函数呢?能让我通过函数具体知道是什么错误,能渠道错误码返回的字符串信息,谢谢
|
|
|
可以使用FormatMessage();来获得具体的出错信息 可以查msdn
有这样一段例子 Remarks The FormatMessage function can be used to obtain error message strings for the system error codes returned by GetLastError, as shown in the following sample code. ---> code begins LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); // Process any inserts in lpMsgBuf. // ... // Display the string. MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); // Free the buffer. LocalFree( lpMsgBuf ); ---> code ends |
|