I was writing a simple program at school, and I got stuck on reading text files. I know ... pathetic. But I really don't know the correct syntax for this.
The program asks the user for a filename, opens it, and displays the content. My problem is that I don't know the correct syntax to use ifstream to open a file, with a filename that the user inputs. Basically, how do I tell it to read a file without using quotation marks ?
I was thinking along the lines of:
But the above wouldn't compile.Code:ifstream a_file (<<location<< ); // location bieng the string in which the filename & location are stored.
Any help (as always) gratefully appriciated.