Hey,
I am coding a program where the user enters the name of a student and the program looks for a file named [the student name] + .txt.
the code I use the read from the file looks like this:
Code:
ifstream OpenFile("student.txt");
char ch;
while(!OpenFile.eof())
{
OpenFile.get(ch);
cout << ch;
}
OpenFile.close();
To get file name I use this code
Code:
string FindStudent = "";
cout << "Student name:";
cin >> FindStudent;
FindStudent += ".txt";
Now, what I would like to do is take the "FindStudent" variable and make that the name of the file that its opening.
Sorry if I did a bad job explaining that but I'm running on no sleep.
-Thanks