I was woundering if it was possible to have fstream open a variable filename like instead of having to tell it the name have the name of the file x.txt so it opens any txt file, or have the user define the filename. its kinda hard to explain but ive been woundering this for a while now.
thanks in advance
Certainly. Just use a variable name for the file name, and set the file name before calling open.
could you show me an example, im still kinda stuck.
std::string filename( "blah.txt" );
std::fstream file( filename.c_str() );