Have a project I'm working on in my free time offshore that I'm sure I'll be here quite often.
I can get access to the file and have it print to the console if I hard code in the directory of the file. How would I go about using user input to open a file in a specified directory I'm already pointing to?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <fstream>
#include <string>
int main()
{
string filename;
cout << "Enter the file name with the .csv extension: ";
getline(cin, filename);
ifstream myfile;
myfile.open ("C:\\Program Files\\DataLog Express\\"user defined filename here"");
while (myfile.good())
cout << (char) myfile.get();
}