原始日期:2013-09-30 23:22html
今天看C++Primer的时候发现一个问题,getline须要输入2次回车才会显示结果,上网找了一下,发现是VC6.0的缘由,修复缘由以下:this
(1)创建一个1.CPPspa
(2)输入#include <string>code
(3)右击<string>,选择“打开文档<string>”htm
(4)用CTRL+F查找 else if (_Tr::eq((_E)_C, _D))blog
(5)文档
1 else if (_Tr::eq((_E)_C, _D)) 2 {_Chg = true; 3 _I.rdbuf()->snextc(); 4 break; }
将上面的代码修改成get
1 else if (_Tr::eq((_E)_C, _D)) 2 {_Chg = true; 3 // _I.rdbuf()->snextc(); 4 // (this comments out the defective instruction) 5 _I.rdbuf()->sbumpc(); // corrected code 6 break; }
保存退出后便可修复这个问题.
转载自:http://www.cnblogs.com/EnCaL/archive/2012/12/03/2800138.html