Read one line from a text file

File stream is great for reading data to and from files,. Mainly because it always makes sure to close the file when the object goes out of scope, which means that we don’t need to remember to call close(), but also because it makes it possible to parse the contents of the file.

Sometimes we don’t want to parse the contents but just read the data one line at a time.

 

Facebookgoogle_pluslinkedinmail