#include <openssl/err.h>
ERR_load_ERR_strings();
ERR_load_crypto_strings();
ERR_load_BIO_strings();
// // 获取错误号
unsigned long ulErr = ERR_get_error();
//unsigned long ulErr = ERR_get_error_line_data();
char szErrMsg[1024] = {0};
char *pTmp = NULL;
unsigned int len;
// 格式:error:errId:库:函数:原因
pTmp = ERR_error_string(ulErr,szErrMsg);
ERR_error_string_n(ulErr,szErrMsg, &len);
int flags1, line1;
char *data1, *file1;
unsigned long code1;
code1 = ERR_get_error_line_data(&file1, &line1, &data1, &flags1);
log("error code: %lu in %s line %d.\n", code1, file1, line1);