I was wondering how i could make this work, I have been trying a few different ways and only get compiling errors
what i need to do is prompt the user to input a string that will then be used to name a .txt file like so:
CODE
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
string file_name;
cout<<"Please enter the name of the file i will create for you"<<endl;
cin>>file_name; // filetest.txt
ofstream f;
f.open(file_name); // this is the part that is killing me, how can
// i enter a user specified string into this field?
f<<"All this text is being written to the file";
return 0;
}
thank you in advance for whatever help i can get with this!!
This post has been edited by nirovanton: 10 Apr, 2007 - 04:03 PM