It may be common sense, but since you asked I thought I would add, the command your using is to read a file.
The command Peter87 gave you is to write a file.
You only create files on a Write operation.
I understand that std::fstream afile creates a file stream that can be read and written to. I'm not sure I understand what you mean?
http://www.cplusplus.com/doc/tutorial/files/
With fstream, you have the option of both "ios::in" which is input reading from file, and "ios::out" which is output writing to file.
ofstream would be the alternative to writing to file, and ifstream would be the alternative to reading from file.
Options are provided in the link above.