File creation

Hi everyone,
I've created this program:
1
2
3
4
5
6
7
8
9
10
11
12
#include <fstream>
#include <iostream>
#include <string>

int main()
{
string rName;
cin >> rName;
string file = rName + ".name.txt"
ifstream myfile;
myfile open(file);
}

That should create a file when run. But when I do, and then search for the file on my computer, I can't find it. Is there a problem with the code I wrote?
This is an attempt to open a file for reading. It would be silly for such a thing to create the file it's meant to be reading from.
http://www.cplusplus.com/reference/iostream/ifstream/open/

Perhaps you meant to open a file to write to?
http://www.cplusplus.com/reference/iostream/ofstream/open/
Topic archived. No new replies allowed.