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

c++, file, fstream, std

Solution

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.

Problem

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 around in the file, whereas with `ios::ate` it can only read/write at the end of the file. Is this correct?

Original source

Related problems