le voila, je previens je ne comprend pas tout les subtilitées de fread et fwrite.
Si tu peux m'aider ca serais vraiment genial.
Merci de regarde.
long PremCarPos (char *ch, FILE *f,long Depart)
{
char c,nvLigne [TAILLE];
int i=0,t,n;
char *l;
t=strlen(ch);
fseek(f,Depart,SEEK_SET);
while(! feof(f))
{
c=fgetc(f);
nvLigne[i]=c;
i++;
l=strstr(nvLigne,ch);
n=strlen(nvLigne);
Depart=n-t-1;
if (l != NULL)
{
VideChaine(nvLigne);
return (Depart);
}
}
return 0;
}
void ModificationFichier (char *ch1,char *ch2,FILE *fd,FILE *ftmp)
{
int Lch2;
long Depart=0,length;
char *memoir;
memoir=(char*)malloc(TAILLE);
Depart=0;
Lch2=strlen(ch2);
Depart=PremCarPos(ch1,fd,Depart);
while(!feof(fd));
{
length=fread(memoir,1,Depart,fd);
fwrite(memoir,1,length,ftmp);
fwrite(ch2,1,Lch2,ftmp);
Depart=Depart+Lch2;
Depart=PremCarPos(ch1,fd,Depart);
fseek(fs,Depart,SEEK_SET);
}
free(memoir);
return ;
}