更新时间:1970-01-01 07:55:54
使用最近的Delphi版本,您可以使用 TStreamReader
。使用您的文件流构建它,然后调用其 ReadLine
方法(继承自 TTextReader
)。
With recent Delphi versions, you can use TStreamReader
. Construct it with your file stream, and then call its ReadLine
method (inherited from TTextReader
).
所有Delphi的选项版本是使用 Peter Below's StreamIO 单位,它给你 AssignStream
。它的工作方式就像 AssignFile
,但是对于流而不是文件名。一旦您使用该函数将流与 TextFile
变量相关联,您可以调用 ReadLn
,另一个/ O函数就像任何其他文件一样。
An option for all Delphi versions is to 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.