没有谎言在文本文件中。 [英] No of lies in a text file.

查看:65
本文介绍了没有谎言在文本文件中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我希望有人可以指出我正确的方向,我从文本文件中读到了一个问题。

我试图找出文本中有多少行数据文件,该文件将包含这种格式的名称列表:

john

dave

bob



到目前为止我编写了以下代码:

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号

解决方案

它会在while循环中卡住,因为你永远不会从文件中读取它所以它从不r EOF。您需要阅读文字,例如在< string>中使用getline()
http:// www .cppreference.com / cppstring / getline.html


好的,我想我会关注。

我必须慢慢地通过它。

谢谢


对不起我还没有运气,我试过这个:

展开 | 选择 | Wrap | 行号

Hello everyone I was hoping someone could point me in the right direction with a problem I have reading from a text file.
I am trying to find out how many lines of data are in a text file,the file will contain a list of names in this sort of format:
john
dave
bob
etc.
I have written the following code so far:

Expand|Select|Wrap|Line Numbers

解决方案

it gets stuck in the while loop because you never read from the file so it never reaches EOF. You need to read the text, e.g. use getline() in <string>
http://www.cppreference.com/cppstring/getline.html


Ok, I think I follow.
I''ll have to go through it slowly.
Thanks


Sorry I am still having no luck, I have tried this:

Expand|Select|Wrap|Line Numbers


这篇关于没有谎言在文本文件中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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