日期:2014-05-16 浏览次数:20695 次
struct stat fpStat = {0};
if(stat("/test/test.cfg", &fpStat) < 0)//该文件大小5600字节
return -1;
perror("Error:");
printf("=========Size:%d==\n", fpStat.st_size);
int ret;
if((fp = fopen(SYS_FILE, "rb")) == NULL){
printf("=====File:%s is not exist===\n", SYS_FILE);
ret = FAIL;
} else {
if(fread(Buffer, 1, SYS_ENV_SIZE,fp) != SYS_ENV_SIZE){
printf("=====File:%s read(%d)===\n", SYS_ENV_SIZE);
ret = FAIL;
} else {
ret = SUCCESS;
}
fclose(fp);
}