流阅读器 [英] stream reader

查看:118
本文介绍了流阅读器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用streamReader从硬盘读取文件。我读过的一些文件

在行尾有空格。无论我使用什么代码

StreamReader1 = System.IO.File.OpenText(file)



StreamReader1 = New System.IO.StreamReader (文件)

然后

StreamReader1.ReadToEnd()



StreamReader1.ReadLine()

我在回复中丢失了空格。我需要更改以阅读所有数据。

Aleks Kleyn

I use streamReader to read files from hard drive. Some files which I read
have spaces at the end of line. However whatever code I use
StreamReader1 = System.IO.File.OpenText(file)
or
StreamReader1 = New System.IO.StreamReader(file)
and then
StreamReader1.ReadToEnd()
or
StreamReader1.ReadLine()
I am losing spaces in the response. What I need to change to read all data.
Aleks Kleyn

推荐答案

Aleks Kleyn写道:
Aleks Kleyn wrote:

我使用streamReader从硬盘读取文件。我读取的一些文件在行尾有空格。无论我使用什么代码

StreamReader1 = System.IO.File.OpenText(file)



StreamReader1 = New System.IO.StreamReader (文件)

然后

StreamReader1.ReadToEnd()



StreamReader1.ReadLine()

我在回复中丢失了空格。我需要更改以阅读所有数据。

Aleks Kleyn
I use streamReader to read files from hard drive. Some files which I
read have spaces at the end of line. However whatever code I use
StreamReader1 = System.IO.File.OpenText(file)
or
StreamReader1 = New System.IO.StreamReader(file)
and then
StreamReader1.ReadToEnd()
or
StreamReader1.ReadLine()
I am losing spaces in the response. What I need to change to read all data.
Aleks Kleyn



您是否确定在阅读文本时丢失了空格

文件?您是否确认该文件实际上包含那些

空格,并且它们确实是空格字符?


当没有任何东西被删除时没有任何意义阅读文件。

阅读后如何处理文本,以及如何确定空格丢失?


-

G ??跑安德森

_____
http://www.guffa.com


" Aleks Kleyn" < Al ********* @ MailAps.orgschrieb:
"Aleks Kleyn" <Al*********@MailAps.orgschrieb:

>我使用streamReader从硬盘读取文件。我读过的一些文件
在行尾有空格。无论我使用什么代码

StreamReader1 = System.IO.File.OpenText(file)



StreamReader1 = New System.IO.StreamReader (文件)

然后

StreamReader1.ReadToEnd()



StreamReader1.ReadLine()

我在回复中丢失了空格。我需要更改以阅读所有

数据。
>I use streamReader to read files from hard drive. Some files which I read
have spaces at the end of line. However whatever code I use
StreamReader1 = System.IO.File.OpenText(file)
or
StreamReader1 = New System.IO.StreamReader(file)
and then
StreamReader1.ReadToEnd()
or
StreamReader1.ReadLine()
I am losing spaces in the response. What I need to change to read all
data.



如何查看从文件中读取的数据?


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http:// dotnet .mvps.org / dotnet / faqs />


How do you take a look at the data read from the file?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


这很简单。我知道文件行最后有空格的地方

(例如ba)然后我把断点放在我读取

文件的地方,将变量的值复制到记事本中,并在查看后查看

''a''下一行是立即执行。发现我这是因为流是

没有按照我的预期进行。


Aleks Kleyn

It is very simple. I know place where line of file has spaces in the end
(for instance "ba ". Then I put break point at place where I read the
file, copy the value of variable into notepad and see that after charecter
''a'' next line follows imediately. Discovered I this because stream was
procede not way as I expected.

Aleks Kleyn


这篇关于流阅读器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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