C++ can I reuse fstream to open and write multiple files?

前端 未结 3 1466
温柔的废话
温柔的废话 2020-12-06 09:31

I have 10 files need to be open for write in sequence. Can I have one fstream to do this? Do I need to do anything special (except flush()) in between each file or just call

3条回答
  •  长情又很酷
    2020-12-06 10:16

    Closing a stream implies flush(), so as long as you close() each stream before you open the next one you should be fine.

提交回复
热议问题