file names (SOS)! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

file names (SOS)!

i want to import a file name in my hard disc and assign it to string in my program, how can i do it?

30th Jan 2020, 1:32 AM
Max
Max - avatar
1 Answer
+ 7
string myText; // Read from the text file ifstream MyReadFile("filename.txt"); while (getline (MyReadFile, myText)) {   // Output the text from the file   cout << myText; } You must include fstream lib
30th Jan 2020, 1:47 AM
Jobelle
Jobelle - avatar