Creating a file from console

So, I have question. I already know how to open a txt file so you can write data to it and close it but lets say I wanted to have a console application that prompts the user to enter in the name of a text file to create. So the user would enter in the name and then it would create a text file and allow you to edit the file.

So it would be like

Enter file name to create: example.txt

Opening example.txt

(allows you to edit example.txt (or whatever you called the file and then closes the file)

Is that possible and what would that look like?
Instead of a ifstream object that you'd use for reading the file, you'd use a ofstream object for writing a file.

If the file doesn't exist, it'll create it. If the file does exist, it'll overwrite it.
So what would that look like in actual code? Sorry, I 'm very much a visual person and I need to see physical code or it wont make sense for me. An example would be fantastic
Topic archived. No new replies allowed.