fflush only flushes output stream. Hence you need to put fseek(ft,0,SEEK_CUR)
above your fputs(ft)
fflush(FILE *stream) not working? [duplicate]
-
15-10-2022 - |
Domanda
while(1)
{
ch=fgetc(ft);
if(ch==EOF)
{
break;
}
if(ch=='u')
{
fputc('b',ft);
fflush(ft);
}
}
I tried to replace character after u
with b
in a file pointed by *ft
.
This code runs fine but when I open the file it seemed to be unedited.
The above code works fine with fseeks(ft,0,SEEK_CUR)
.
Why it is not working with fflush(ft)
.
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow