【VC6.0】getline須要輸入2次回車纔會結束的BUG修復方法

原始日期: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
相關文章
相關標籤/搜索