FILE *fpa,*fpb;
char buf[5];
if ((fpa = fopen("..\\","rb"))==NULL)
return 0;
if ((fpb = fopen("..\\","wb"))==NULL)
return 0;
memset(buf,0,5*sizeof(char));
fseek(fpa,0,SEEK_SET);
fseek(fpb,0,SEEK_SET);
while (1)
{
if (fread(buf,1,1,fpa)!=1)
{
if (!feof(fpa))
{
cout<<"file read error!"<<endl;
}
else
{
break;
}
}
if ((fwrite(buf,1,1,fpb)) !=1)
{
cout<<"file write error!"<<endl;
}
}
fclose(fpa);
fclose(fpb);
char buf[5];
if ((fpa = fopen("..\\","rb"))==NULL)
return 0;
if ((fpb = fopen("..\\","wb"))==NULL)
return 0;
memset(buf,0,5*sizeof(char));
fseek(fpa,0,SEEK_SET);
fseek(fpb,0,SEEK_SET);
while (1)
{
if (fread(buf,1,1,fpa)!=1)
{
if (!feof(fpa))
{
cout<<"file read error!"<<endl;
}
else
{
break;
}
}
if ((fwrite(buf,1,1,fpb)) !=1)
{
cout<<"file write error!"<<endl;
}
}
fclose(fpa);
fclose(fpb);