char NAME[256]; cin.getline (NAME,256); ofstream fout(\"NAME.txt\"); //NAME???????
What i need to do to create file with NAME name?
Like this:
#include #include std::string filename; std::getline(std::cin, filename); std::ofstream fout(filename);
In older versions of C++ the last line needs to be:
std::ofstream fout(filename.c_str());