Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Section 7.21.5.3 of C11 places the following restrictions on update streams [ISO/IEC 9899:2011] places the following restrictions on update streams:

When a file is opened with update mode both . . ., 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, or rewind), 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. Opening (or creating) a text file with update mode may instead open (or create) a binary stream in some implementations.

...

CERT C++ Secure Coding Standard: FIO39-CPP. Do not alternately input and output from a stream without an intervening flush or positioning call

ISO/IEC 9899:2011 Section  Section 7.21.5.3, "The fopen function"

...