You are mixing two distinct streams: The C-stream opened with fopen and the C++ stream opened with the default open-mode. In your code, the first is plain useless.
You might try:
#include <fstream>
int main() {
std::ofstream fout ("p_all.txt", std::ios_base::app);
fout << "Hello\n";
}