...
The C Standard, subclause 7.19.5.3, paragraph 66 [ISO/IEC 9899:1999], places the following restrictions on FILE
objects opened for both reading and writing [ISO/IEC 9899:1999]:
When a file is opened with update mode . . ., both input and output may be performed on the associated stream. However, output shall not be directly followed by input without an intervening call to the
fflush
function or to a file positioning function (fseek
,fsetpos
, orrewind
), and input shall not be directly followed by output without an intervening call to a file positioning function, unless the input operation encounters end-of-file.
...