Add some error checking (ex is_open()) to check whether the file has actually been opened. It is possible that the file is not being created because you do not have permissions, etc.
You can get the error description using strerror() http://www.cplusplus.com/reference/cstring/strerror/
Also, have a look at ofstream. http://www.cplusplus.com/reference/ostream/ostream/?kw=ostream