Below is a piece of code that opens a file.
if I got readFile(fileName) where "fileName" is a string containing a file the program does not compile.
Code:string fileName; fileName = "blah.txt"; ifstream readFile; readFile.open(fileName);if I enter the file name directly in quotes it works. How do I specify the file I want to open using a variable?Code:ifstream readFile; readFile.open("blah.txt");
I've of course #include 'ed string and fstream