C++ 里面get和getline输入方法

  C++ 里面get和getline输入方法
诺曼狗狗 发表于 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 );
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值