Home > Back-end >  A problem of file operations
A problem of file operations

Time:10-13

Infile outfile FILE * and * and * temp;
Outfile=fopen (" d: \ \ copy. Bin ", "ab +");
Infile=fopen (" d: \ \ tobecalc bin ", "rb");
Unsigned char buf [2048].
If (outfile==NULL | | infile==NULL)
{
Printf (" % s % s ", "tobecalc", "not exit \ n");
exit(1);
}
Int rc;
/*
While ((rc=fread (buf, sizeof (unsigned char), 2048, infile))!=0)
{
Fwrite (buf, sizeof (unsigned char), rc, outfile);
}
*/

Fread (buf, sizeof (unsigned char), 2048, infile);
Fwrite (buf, sizeof (unsigned char), 2048, outfile);

Into outfile write 2048 data in the file pointer, so why didn't write reaction, of the data in buf is read

CodePudding user response:

I'll let you know, obviously not, to search, thank you

CodePudding user response:

Int _tmain (int arg c, _TCHAR * argv [])
{
Infile outfile FILE * and * and * temp;
Unsigned char buf [2048].

Infile=fopen (" F: \ \ music \ \ Smooth mp3 ", "rb");
Outfile=fopen (" f: \ \ new_smooth mp3 ", "wb");

Int rc;
While ((rc=fread (buf, sizeof (unsigned char), 2048, infile))!=0)
{
Fwrite (buf, sizeof (unsigned char), rc, outfile);
}

Fread (buf, sizeof (unsigned char), 2048, infile);
Fwrite (buf, sizeof (unsigned char), 2048, outfile);
The fclose (infile);
The fclose (outfile);
return 0;
}

Altered directly in your code, look at myself

CodePudding user response:

This for many reasons, first of all to ensure that the d: \ \ copy inside the bin with the pointer to the data and not file

Sometimes may refresh delay, to close the file or refresh the resource manager to see the effect
  • Related