Reading User Defined Files
Hi all.
I was writing a simple program at school, and I got stuck on reading text files. I know ... pathetic. :rolleyes: 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:
Code:
ifstream a_file (<<location<< );
// location bieng the string in which the filename & location are stored.
But the above wouldn't compile.
Please help.
Any help (as always) gratefully appriciated. :cool: