fseek fread fwrite fflush

Stephen R. van den Berg berg at marvin.e17.physik.tu-muenchen.de
Mon Apr 15 21:38:31 AEST 1991


Andrew Walduck writes:
>Is it necessary to do the following?

>fflush(fp);
>fseek(fp....);
>fwrite(fp...);

>Or can I just do the following...

>fseek(fp....);
>fwrite(fp....);

According to the ANSI standard library, the latter can be practiced.
Every fseek performs an implicit fflush.  Though, extra fflushes won't
hurt.
--
Sincerely,                 berg at marvin.e17.physik.tu-muenchen.de
           Stephen R. van den Berg.
"I code it in 5 min, optimize it in 90 min, because it's so well optimized:
it runs in only 5 min.  Actually, most of the time I optimize programs."



More information about the Comp.lang.c mailing list