Which one is better and preferred? I am really finding the reading API confusing.
The member version reads into a char*
, the free version reads into a std::string
. So prefer the free version! Use it like this:
std::istream & ins = /* ... */;
std::string line;
while (std::getline(ins, line))
{
// process line
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With