getline - refresher

B

brekehan8

Been a long long time since I did basic file parsing. See what working
with your employers libraries does to you?!

I am using fstream::getline. I cannot remember, if I attempt to read a
line that is longer than my provided buffer size, will fstream::fail()
return true, and therefore fstream::good() return false?

Is there any other way to parse a line of a file at a time directly
into a string or stringstream, since it ends up there anyway in my
code?
 
B

brekehan8

Or heck, I would even be happy if I could read the entire file
directly into a stringstream, because I am going to use the extractor
and string's find methods now that I think about it.
 
J

Jerry Coffin

Or heck, I would even be happy if I could read the entire file
directly into a stringstream, because I am going to use the extractor
and string's find methods now that I think about it.

For that, you can use something like:

std::stringstream buffer;

buffer << input_stream.rdbuf();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,690
Latest member
MacGyver

Latest Threads

Top