Why doesnt getline() work with files? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why doesnt getline() work with files?

I tried #include <fstream> #include <string> ifstream Myfile("file.txt"); int temp;. //to get and store file values temporarily while(Myfile) { getline (Myfile, temp, ' , '); // to delimit CSV } How can I fix this?

22nd Apr 2018, 7:54 AM
Whiless
Whiless - avatar
1 Answer
+ 1
What exactly happened when you executed it? (Btw. the playground doesn't support file interaction as far I know)
22nd Apr 2018, 8:33 AM
Aaron Eberhardt
Aaron Eberhardt - avatar