fseek fread fwrite fflush

Thomas Murphy tmurphy%peruvian.utah.edu at cs.utah.edu
Sat Apr 13 11:45:47 AEST 1991


In article <1991Apr13.003817.12434 at watdragon.waterloo.edu> amewalduck at trillium.waterloo.edu (Andrew Walduck) writes:
>I've got a question about fseek, fread, fwrite and fflush....
>Is it necessary to do the following?
>fflush(fp);
>fseek(fp....);
>fwrite(fp...);

You are always safest if you flush streams btwn io phases...this goes
for io to the console or to some file...thus if you have been reading
you should flush before writing and again before returning to reading
again and in addition flush before closing.....sounds like rules of
the john eh?

murph
thomas murphy
u of u
tmurphy%peruvian at cs.utah.edu






More information about the Comp.lang.c mailing list