java
sql
php
css
xml
python
mysql
linux
android
ruby-on-rails
eclipse
silverlight
html5
json
perl
oracle
cocoa
asp
postgresql
A std::ofstream is an output stream. By definition, it cannot input data. So giving it fstream::in as a flag is wrong.
std::ofstream
fstream::in
If you want a file stream you can input and output to, use std::fstream.
std::fstream
Admittedly, this may not be what's causing your problem. But it is wrong.
The most common reason stuff doesn't get written to a file is because you forgot to close the stream when you were done: myfile.close(); somewhere before the program exits. This flushes the buffer and makes sure everything is actually written to the file, and not sitting in any caches along the way.d
myfile.close();