Why can't an output be followed by an input and vice versa?

后端 未结 1 1115
花落未央
花落未央 2021-01-13 06:39

From APUE

When a file is opened for reading and writing (the plus sign in the type), two restrictions apply.

• Output canno

相关标签:
1条回答
  • 2021-01-13 07:32

    When working with a FILE stream, there is a single internal buffer used when either reading from or writing to the file.

    When switching between reading and writing, that buffer must be cleared before switching modes, otherwise data loss could potentially occur. Each of the operations mentioned above perform the required flushing of the buffer.

    0 讨论(0)
提交回复
热议问题