开发者

stringstream.good() > Different behaviour in VS and Eclipse compiler

I have some understanding problems regarding the stringstream.

Example:

stringstream stream(commands);

    while (true) {
        string line;
        getline(stream, line);

        if (!stream.good())
            break;
        if (line.size() > 0){
            lines.push_back(line);
        }
        else{
             break;
        }
    }

If I use this code in Eclipse it's no problem, it work as expected. Using this in Vistual Studio 2005 stream.good() seems to return always开发者_运维百科 false

why?

I would really appreciate some explanation.


To close this Question:

Like etarion said it's just a matter of the good() method. Using some other mechanism works fine. Thanks for your help!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜