Top.Mail.Ru
The C++ Community's Journal -- Day
? ?
The C++ Community's Journal -- Day [entries|friends|calendar]
The C++ Community

[ userinfo | livejournal userinfo ]
[ calendar | livejournal calendar ]

[06 Sep 2003|01:12am]
   ifstream inputFile;
   string Name;

   cout << "Which file would you like to read from? ";
   getline( cin, Name );
   inputFile.open( Name );
 


Does anyone know how to make this actually work? This is obviously part of a larger file, and yes, I included iostream, fstream and string. My compiler tells me something I don't completely understand, but the jist of it is that 'Name' isn't a valid parameter for inputFile.open(). So what -is- a valid parameter? How can I make this work?

I'm pretty sure it would work if I did char[100] Name; instead of string Name; and then passed inputFile.open( Name, 100 )... but I'd really like to use strings if it is possible. Help?
4 comments|post comment

navigation
[ viewing | September 6th, 2003 ]
[ go | previous day|next day ]
Image