逐行读取流

发布于 2024-11-27 22:25:03 字数 136 浏览 2 评论 0原文

Delphi中有没有办法逐行读取流?

有没有办法设置流的编码?

我知道

TEncoding.getEncodingPage(1250); 

如何从流中获取它?

Is there a way in Delphi to read streams ,line by line?

Is there a way to set the encoding of the stream?

I know of

TEncoding.getEncodingPage(1250); 

How to get it from stream?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南…巷孤猫 2024-12-04 22:25:03

我认为您正在寻找 TStreamReader。您在构造函数中设置编码,然后调用 ReadLine< /a>.

就如何从流中获取编码而言,这很大程度上取决于流中的内容,不是吗?

I think you're looking for TStreamReader. You set the encoding in the constructor and then call ReadLine.

In terms of how to get the encoding from the stream, that depends very much on what is in the stream, doesn't it?

你曾走过我的故事 2024-12-04 22:25:03

缺少 TStreamReader 的 Delphi 版本可以使用 Peter下面的StreamIO单元,它为您提供AssignStream。它的工作方式与AssignFile 类似,但针对的是流而不是文件名。使用该函数将流与 TextFile 变量关联后,您可以像调用任何其他文件一样调用 ReadLn 以及其他 I/O 函数。

Delphi versions that lack TStreamReader can use Peter Below's StreamIO unit, which gives you AssignStream. It works just like AssignFile, but for streams instead of file names. Once you've used that function to associate a stream with a TextFile variable, you can call ReadLn and the other I/O functions on it just like any other file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文