ifstream gcount在getline字符串重载时返回0 [英] ifstream gcount returns 0 on getline string overload

查看:172
本文介绍了ifstream gcount在getline字符串重载时返回0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  getline(istream &, string &) 

返回0.

应该是这样吗?

推荐答案

是的,gcount()应该返回通过最后未格式化的输入操作提取的字符数.对象.

Yes, gcount() is supposed to return the number of characters extracted by the last unformatted input operation performed on the object.

getline()在应该更新gcount()的功能中列出,但它是字符串getline() .

getline() is listed in the functions supposed to updated gcount(), but it is the member getline() of a stream and not the string getline().

如有疑问,此链接告诉它白底黑字:与UnformattedInputFunction一样,除了input.gcount()不受影响.

In case of doubt, this link tells it black on white: Behaves as UnformattedInputFunction, except that input.gcount() is not affected.

这篇关于ifstream gcount在getline字符串重载时返回0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆