⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warerror.c

📁 ftpserver very good sample
💻 C
字号:
#include <string.h>#include <assert.h>#include "StdAfx.h"#include <malloc.h>#include <stdlib.h>#include "WarError.h"   // class implementedwar_ccstr_t war_get_system_error_text(const int err_no,                                      war_cstr_t buffer,                                      const size_t buffer_length){    war_ccstr_t p = "";    int i;#ifdef WIN32    war_cstr_t pp = NULL;    LPTSTR tmp_buffer = alloca(sizeof(TCHAR) * buffer_length);    if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,                      NULL,                      err_no,                      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language                      tmp_buffer,                      buffer_length,                      NULL) > 0)    {#ifdef UNICODE        wcstombs(buffer, tmp_buffer, buffer_length);#else        memcpy(buffer, tmp_buffer, buffer_length);#endif        p = buffer;        for(pp = buffer; *pp; pp++)        {            if ((*pp == '\r') || (*pp == '\n'))            {                *pp = 0;                break;            }        }    }#else    p = strerror(err_no);#endif /* WIN32 */    if (NULL == p || 0 == *p)    {        for(i = 0; NULL != WarSysErrorText[i].mErrotText; ++i)        {            if (WarSysErrorText[i].mErrorCode == err_no)            {                p = WarSysErrorText[i].mErrotText;                break;            }        }    }    return p;}war_ccstr_t war_get_local_error_text(const int err_no){    int i;    for(i = 0; NULL != WarErrorText[i].mErrotText; ++i)    {        if (WarErrorText[i].mErrorCode == err_no)            return WarErrorText[i].mErrotText;    }    return "";}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -