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?
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?
I think you're looking for
TStreamReader
. You set the encoding in the constructor and then callReadLine
.In terms of how to get the encoding from the stream, that depends very much on what is in the stream, doesn't it?
Delphi versions that lack
TStreamReader
can use Peter Below's StreamIO unit, which gives youAssignStream
. It works just likeAssignFile
, but for streams instead of file names. Once you've used that function to associate a stream with aTextFile
variable, you can callReadLn
and the other I/O functions on it just like any other file.