...
Receiving input from a stream directly following an output to that stream without an intervening call to fflush()
, fseek()
, fsetpos()
, or rewind()
, or outputting to a stream after receiving input from it without a call to fseek()
, fsetpos()
, rewind()
if the file is not at end-of-file results in undefined behavior. Consequently, a call to fseek()
, fflush()
or fsetpos()
is necessary between input and output to the same stream (see FIO07-C. Prefer fseek() to rewind()).
...
Noncompliant Code Example
The following non-compliant noncompliant code example appends data to a file and then reads from the same file.
...