「istream& getline (istream& is, string& str)」関数と混乱し、http: //www.cplusplus.com/reference/string/string/getline/ によると、次のプログラム:
#include <iostream>
#include <sstream>
int main()
{
std::istringstream s("this is a test");
std::string line = "line ";
getline( s, line );
std::cout << line << std::endl;
s.str("test again");
getline( s, line );
std::cout << s.str() << std::endl;
std::cout << line << std::endl;
return 0;
}
出力は次のようになると思います。
行これはテストです
再テスト
再テスト
しかし、Visual Studioでテストすると、出力は次のようになります:
これはテストです
再テスト
これはテストです
イライラする機能を誰か説明してもらえますか?