由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - C++ string类输入数据的问题
相关主题
问个C/C++题目贡献一c++面试题
Linux下C++如何快速返回超大文件的某一行字符串?求助,这样从c++输入窗口读入一连串的单词或数字呢?
C++ string to int Problem关于文件读取的C++ 问题?
C++如何输入的一个小问题C++ read matrix from txt file
how to read a sentence into a vector of string?New C++ programmer, need to ask a I/O file read question
C++ 屏幕输入问题请教一个C++关于输入输出的问题
Visual Studion 10, C++ string问题:表现不一致help on string parse
天,如何能让程序转得快点?有包子。C++读文本文件怎么判断换行?
相关话题的讨论汇总
话题: getline话题: rdbuf话题: string话题: cin话题: freebsd
进入Programming版参与讨论
1 (共1页)
B********s
发帖数: 3610
1
我定义一个string对象s,希望从键盘输入一个字符串,回车结束
cin >> s 输入的字符串不能有空格
getline(cin,s,'\n') 则需要按两下enter
请问有没有更好的办法?
I*l
发帖数: 1649
2
just getline (cin, s);



【在 B********s 的大作中提到】
: 我定义一个string对象s,希望从键盘输入一个字符串,回车结束
: cin >> s 输入的字符串不能有空格
: getline(cin,s,'\n') 则需要按两下enter
: 请问有没有更好的办法?

b******u
发帖数: 10
3
Quoted from http://support.microsoft.com/kb/240015
Modify the getline member function, which can be found in the following
system header file string, as follows:
else if (_Tr::eq((_E)_C, _D))
{_Chg = true;
// _I.rdbuf()->snextc(); /* Remove this line and add the line
below.*/
_I.rdbuf()->sbumpc();
break; }


【在 B********s 的大作中提到】
: 我定义一个string对象s,希望从键盘输入一个字符串,回车结束
: cin >> s 输入的字符串不能有空格
: getline(cin,s,'\n') 则需要按两下enter
: 请问有没有更好的办法?

b******u
发帖数: 10
4
I assume LZ built the code on Win32. The original code works fine on FreeBSD.

line

【在 b******u 的大作中提到】
: Quoted from http://support.microsoft.com/kb/240015
: Modify the getline member function, which can be found in the following
: system header file string, as follows:
: else if (_Tr::eq((_E)_C, _D))
: {_Chg = true;
: // _I.rdbuf()->snextc(); /* Remove this line and add the line
: below.*/
: _I.rdbuf()->sbumpc();
: break; }
:

B********s
发帖数: 3610
5
对,我是在win32下做的

FreeBSD.

【在 b******u 的大作中提到】
: I assume LZ built the code on Win32. The original code works fine on FreeBSD.
:
: line

1 (共1页)
进入Programming版参与讨论
相关主题
C++读文本文件怎么判断换行?how to read a sentence into a vector of string?
C++ Q13: InputC++ 屏幕输入问题
输入输出流,stl,api精通各需要多长时间?Visual Studion 10, C++ string问题:表现不一致
请教一个C++的问题天,如何能让程序转得快点?有包子。
问个C/C++题目贡献一c++面试题
Linux下C++如何快速返回超大文件的某一行字符串?求助,这样从c++输入窗口读入一连串的单词或数字呢?
C++ string to int Problem关于文件读取的C++ 问题?
C++如何输入的一个小问题C++ read matrix from txt file
相关话题的讨论汇总
话题: getline话题: rdbuf话题: string话题: cin话题: freebsd