If you intend to open an fstream for output in ios::app mode, do you really need to also specify ios::out as well? For my specific compiler, using just ios::app and not ios::out | ios::app allowed me to output to the file. Doesn't ios::app already assume that you are opening the file for output?
It would depend on if you defined the file stream as a "fstream" or an "ofstream".
For "fstream" you need to tell it if it is for input or output. At least that has been the way I have understood it. I will also say that I have never tried to use just "std::ios::app" when opening an output file stream. I will have to give that a try.
It would help if you would mention your IDE and compiler as there are differences.
It has been my experience that when using a "fstream" it is best to start with telling the stream if it is for "in", "out or both before you add any other mode flags.
This is one of times when something is found by accident or testing, but do not count on it working all the time. As soon as you do it will fail.