?? 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 + -