0

Hello All,

Can I use cin.getline(x,y) to read a line from a file?

What is the form of cin.getline(x,y) when used with files?

What I need to do is to output what I have written to a file to the console.

I have the file open, using ofstream, and I save names to it. Then I close the file and re-open it, using ifstream, and want to read what I have saved to it.

Thanks a lot for any suggestions.

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Salem
0

ifstream fin
fin.getline

cin and cout just happen to be streams already opened for you. Otherwise, everything else is identical.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.