小编use*_*692的帖子

逐行读取txt

我在C++中逐行读取文本文件.我正在使用此代码:

while (inFile)
{
getline(inFile,oneLine);
}
Run Code Online (Sandbox Code Playgroud)

这是一个文本文件:

-------

This file is a test to see 
how we can reverse the words
on one line.

Let's see how it works.

Here's a long one with a quote from The Autumn of the Patriarch. Let's see if I can say it all in one breath and if your program can read it all at once:
Another line at the end just to test.
-------
Run Code Online (Sandbox Code Playgroud)

问题是我只能阅读段落以"这是一个很长的等..."开头,它立即停止:"我无法解决阅读所有文本.你有什么建议吗?

c++ file ifstream

3
推荐指数
1
解决办法
419
查看次数

标签 统计

c++ ×1

file ×1

ifstream ×1