📄 fileserv.c
字号:
///////////////////////////////////////////////////////////////////////////////
//
// FileName : FileServ.c
// Version : 0.10
// Author : Luo Cong
// Date : 2004-09-02 (yyyy-mm-dd)
// Comment :
//
///////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <malloc.h>
#include "Misc.h"
#include "FileServ.h"
int ReadFileContents(
/* [in] */ const char *szFileName
)
{
int nRetResult = 0;
FILE *fp_in = NULL;
fp_in = fopen(szFileName, "rb");
if (NULL == fp_in)
{
printf(ErrMsg[ERR_OPEN_FILE], szFileName);
goto Exit0;
}
fseek(fp_in, 0L, SEEK_END);
g_lFileSize = ftell(fp_in);
rewind(fp_in);
g_FileContents = (char *)malloc(g_lFileSize);
if (NULL == g_FileContents)
{
printf(ErrMsg[ERR_MALLOC_MEMORY], szFileName);
goto Exit0;
}
fread(g_FileContents, 1, g_lFileSize, fp_in);
nRetResult = 1;
Exit0:
if (fp_in)
{
fclose(fp_in);
fp_in = NULL;
}
return nRetResult;
}
void FreeFileContents()
{
if (g_FileContents)
{
free(g_FileContents);
g_FileContents = NULL;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -