Discussion Locked

Read lines from streams

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
The get_line function promises to make reading lines from streams less cumbersome. Tell us how you will use it in your application development.

2 replies

by Mark W. Kaelin

I received this e-mail today - anyone want to provide an answer:

how do I read a determined line in a .txt file ?

i.e. I want to display in console the 45th line of a file.

by john torjo

There are multiple ways to achieve the above.

With the help of two tips we just published, you could do the following:

std::ifstream streamIn( strFileName);
std::string strLine;
streamIn >> ignore_lines( 44) >> get_line( strLine);

Best,
John

This discussion is closed to new replies.