C++ 里面get和getline输入方法
诺曼狗狗 发表于 2007-5-1 8:19:00
诺曼狗狗 发表于 2007-5-1 8:19:00
// 除了通常我们用的>>操作符,可能还有几个函数比较重要,整理了一下
// 以下函数声明在
int_type get();
__istream_type& get(char_type& __c);
__istream_type& get(char_type* __s, streamsize __n, char_type __delim);
inline __istream_type& get(char_type* __s, streamsize __n)
{ return this->get(__s, __n, this->widen('/n')); }
__istream_type& get(__streambuf_type& __sb, char_type __delim);
inline __istream_type& get(__streambuf_type& __sb)
{ return this->get(__sb, this->widen('/n')); }
__istream_type& getline
(
char_type* __s,
streamsize __n,
char_type __delim
);
inline __istream_type&
getline( char_type* __s, streamsize __n )
{ return this->getline(__s, __n, this->widen('/n')); }
// 以下函数声明在
template
basic_istream<_CharT,_Traits>&getline
(
basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Alloc>& __str,
_CharT __delim
);
template
inline basic_istream<_CharT,_Traits>&getline
(
basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Alloc>& __str
);
// 基本上,平时上面那些函数会最后实例化成这个样子
int get();
istream& get(char& c);
istream& get(char* s, streamsize n)
istream& get(streambuf& sb, char delim);
istream& get(streambuf& sb)
istream& getline(char* s, streamsize n, char delim);
istream& getline(char* s, streamsize n )
basic_istream& getline( basic_istream& is, basic_string& str, char delim );
basic_istream& getline( basic_istream& is, basic_string& str );
// 以下函数声明在
int_type get();
__istream_type& get(char_type& __c);
__istream_type& get(char_type* __s, streamsize __n, char_type __delim);
inline __istream_type& get(char_type* __s, streamsize __n)
{ return this->get(__s, __n, this->widen('/n')); }
__istream_type& get(__streambuf_type& __sb, char_type __delim);
inline __istream_type& get(__streambuf_type& __sb)
{ return this->get(__sb, this->widen('/n')); }
__istream_type& getline
(
char_type* __s,
streamsize __n,
char_type __delim
);
inline __istream_type&
getline( char_type* __s, streamsize __n )
{ return this->getline(__s, __n, this->widen('/n')); }
// 以下函数声明在
template
basic_istream<_CharT,_Traits>&getline
(
basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Alloc>& __str,
_CharT __delim
);
template
inline basic_istream<_CharT,_Traits>&getline
(
basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Alloc>& __str
);
// 基本上,平时上面那些函数会最后实例化成这个样子
int get();
istream& get(char& c);
istream& get(char* s, streamsize n)
istream& get(streambuf& sb, char delim);
istream& get(streambuf& sb)
istream& getline(char* s, streamsize n, char delim);
istream& getline(char* s, streamsize n )
basic_istream& getline( basic_istream& is, basic_string& str, char delim );
basic_istream& getline( basic_istream& is, basic_string& str );