I wanna have my program be able to let the user manually open a text file by destination and retrieve data from it, I have everything like ifstream good, i just need to know how to let the user cin something like C:/files/myfile.txt, but with the ifstream format I need to use the format ifstream stringname("texthere"); but cant let the user modify the "texthere", im sure its just a simply command, plz help
Manutebecker
0
Junior Poster in Training
Recommended Answers
Jump to Poststring dir_name; getline(cin, dir_name); ifstream file(dir_name.c_str());
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.