I try to copy files using this function, but the output files contains strange characters.
int File_Copy (char FileSource [], char FileDestination [])
{
int result = -1;
char c [1];
FILE *stream_R = fopen (FileSource, "r");
FILE *stream_W = fopen (FileDestination, "w"); //create and write to file
while ((c [0] = (char) fgetc(stream_R)) != EOF)
{
fprintf (stream_W, c);
}
//close streams
fclose (stream_R);
fclose (stream_W);
return result;
}
I do not know what is wrong. Please help.