I want to copy a binary master file in a new binary file. This file contain nothing but have a predefined size (20000 lines).
Here what i'm doing:
FILE *A_Lire;
FILE *A_Creer;
A_Lire = fopen(MASTERPath,"rb");
A_Creer = fopen(PARTPRGPath, "wb");
fseek(A_Lire,0,SEEK_END);
int end = ftell(A_Lire);
char* buf = (char*)malloc(end);
fread(buf,sizeof(char),end,A_Lire);
fwrite(buf,sizeof(char),end,A_Creer);
fclose(A_Creer);
fclose(A_Lire);
This code create the new file with the good size but this is not exactly the same file because I'm not able to used this new file like the master. Something is different, maybe corrupted, maybe the way to write in the file ???
Do you have any idea ???
I think this is MFC code
Thanks,