char* text;
FILE *pf = fopen("d:\\1.dat", "rb");
if (pf)
{
fseek(pf, 0, SEEK_END);
long lSize = ftell(pf);
// 用完后需要将内存free掉
text = (char*)malloc(lSize + 1);
rewind(pf);
fread(text, sizeof(char), lSize, pf);
text[lSize] = '\0';
fclose(pf);
pf = NULL;
。。。。
free(text);
text = NULL;
}