how to read strings from text file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how to read strings from text file?

i am making a program for matching strings entered by the program and the method of fin.getline()is not working in my way.

13th Sep 2016, 8:19 PM
Abhishek Narwal
Abhishek Narwal - avatar
3 Answers
0
I'd have to see the code to be sure it isn't something else.
13th Sep 2016, 9:11 PM
Nick Rodriguez
Nick Rodriguez - avatar
0
fin is the input stream object
14th Sep 2016, 1:30 AM
Abhishek Narwal
Abhishek Narwal - avatar
- 1
Assuming fin is the name of the file, try getline(fin, str) where str is a variable that holds the input from the file.
13th Sep 2016, 9:10 PM
Nick Rodriguez
Nick Rodriguez - avatar