36 lines
540 B
C++
36 lines
540 B
C++
#include "libNPK_StdAfx.h"
|
|
#include "libNPK_Errors.h"
|
|
|
|
|
|
namespace NPK
|
|
{
|
|
|
|
static ErrorCode g_LastError = NPK_ERR_SUCCESS;
|
|
static char g_strLastErrorDesc[1024] = {0};
|
|
|
|
//设置错误
|
|
void setLastError(ErrorCode err, const char* desc, ...)
|
|
{
|
|
g_LastError = err;
|
|
|
|
g_strLastErrorDesc[0] = 0;
|
|
|
|
va_list ptr;
|
|
va_start(ptr, desc);
|
|
_vsnprintf(g_strLastErrorDesc, 1024, desc, ptr);
|
|
va_end(ptr);
|
|
}
|
|
|
|
//得到上一个错误
|
|
ErrorCode getLastErrorCode(void)
|
|
{
|
|
return g_LastError;
|
|
}
|
|
|
|
const char* getLastErrorMessage(void)
|
|
{
|
|
return g_strLastErrorDesc;
|
|
}
|
|
|
|
|
|
} |