如何获取文件句柄,获取后,怎么处理
1个回答
展开全部
FILE *Initfp;
if((Initfp=fopen("D:\\XCM_NUM.dat","r+b"))==NULL)
{
printf("D:\\XCM_NUM.dat can not open!!!!!!!!!!!!!!!!!!!!\n");
fclose(Initfp);
if((Initfp=fopen("D:\\XCM_NUM.dat","w+b"))==NULL){return(FALSE);};
fwrite(XCM_SETUP,sizeof(struct XCM_SETUP_st),1,Initfp);
}else
{
if((i=fread(XCM_SETUP,(sizeof(struct XCM_SETUP_st)),1,Initfp))==0)
{
printf("D:\\XCM_NUM.dat can not read!!!!!!!!!!!!!!!!!\n");
};
};
fclose(Initfp);
if((Initfp=fopen("D:\\XCM_NUM.dat","r+b"))==NULL)
{
printf("D:\\XCM_NUM.dat can not open!!!!!!!!!!!!!!!!!!!!\n");
fclose(Initfp);
if((Initfp=fopen("D:\\XCM_NUM.dat","w+b"))==NULL){return(FALSE);};
fwrite(XCM_SETUP,sizeof(struct XCM_SETUP_st),1,Initfp);
}else
{
if((i=fread(XCM_SETUP,(sizeof(struct XCM_SETUP_st)),1,Initfp))==0)
{
printf("D:\\XCM_NUM.dat can not read!!!!!!!!!!!!!!!!!\n");
};
};
fclose(Initfp);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询