1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
if((entree = fopen(nomfichentree, "rb")) == NULL)
{
fprintf(stderr, "\nError opening %s.\n", nomfichentree);
exit(1);
}
if((sortie = fopen(nomfichsortie, "wb")) == NULL)
{
fprintf(stderr, "\nError opening %s.\n", nomfichsortie);
exit(1);
}
//calcul du nombre d'octet de ton fichier
pos_debut = ftell(entree );
fseek(entree ,0 ,SEEK_END );
pos_fin = ftell(entree );
nbcarac = pos_fin-pos_debut;
//repositionne le fichier au debut
fseek(entree ,0 ,SEEK_SET );
buffertab =calloc(nbcarac,sizeof(char));
fread ( buffertab ,sizeof(char), nbcarac, entree ); |
Partager