Which one is bet开发者_开发问答ter 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
}
精彩评论