Possible Duplicate:
How do I create a file with a user-supplied name in C++?
I was wondering how to have the user enter some text and the program create a file with the text entered by the user as the name of the file.
Thanks In Advance!!
Possible Duplicate:
How do I create a file with a user-supplied name in C++?
I was wondering how to have the user enter some text and the program create a file with the text entered by the user as the name of the file.
Thanks In Advance!!
http://www.cplusplus.com/doc/tutorial/files/
Also look at iostream on that same site. Just go through the tutorial and you'll have it working in no time.
There you go that should get you started. Regardless of whether this is homework or not, you want to learn to do things yourself. I'm not trying to sound rude or condescending, but if you have no desire to learn for coding, then you won't be a good coder. Simple as.
I hope you were asking for pointers on where you can learn and do things your way, rather than get us to write you the code for you.
Ray
Something like this would do:
#include <fstream>
#include <iostream>
#include <string>
int main()
{
std::string filename;
std::cout << "Enter file name: ";
std::cin >> filename;
std::ofstream ofs(filename.c_str());
}
The C++ FAQ reveals all. Erm, well, almost all. http://www.parashift.com/c++-faq-lite/
"Part of going to college is learning how to learn."