The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



TMixedFStream


TMixedFStream opens a named file stream and provides methods to read/write from/to it. TMixedFStream does not distinguish between text files and binary files, it can read/write both text and binary data. This can be especially useful if you have to read a file containing an arbitrary mixture of texts, binary values in different encodings. TMixedFStream assumes that the file stream consists of bytes and interprets the bytes, depending on the applied method.

For example, ReadDecimal expects an ASCII encoded decimal number, while the function ReadInteger expects a binary encoded 32-bit integer number (4 bytes).

See Methods and Properties of TMixedFStream for details.

Sample
program:
The following short program snippet shows how to read a text file line by line. The string FName specifies the path and name of the file to be read:

var
  fs             : TMixedFStream;
  astr           : string;

...
...
fs := TMixedFStream.Create (FName, fmOpenRead);
while not fs.Eos do
  begin
  astr := fs.ReadLn(0);
  // now process astr
  end;
fs.Free;
...
...



Last Update: 2023-Dec-13