C++ Filehandling: Difference between ios::app and ios::ate?

前端 未结 5 1239
轻奢々
轻奢々 2020-11-28 06:13

What\'s the difference between ios::ate and ios:app when writing to a file.
In my view, ios::app gives you the ability to move aro

5条回答
  •  臣服心动
    2020-11-28 06:50

    It’s the other way around. When ios::ate is set, the initial position will be the end of the file, but you are free to seek thereafter. When ios::app is set, all output operations are performed at the end of the file. Since all writes are implicitly preceded by seeks, there is no way to write elsewhere.

提交回复
热议问题