TFileStream

Delphi Streams, streams, ... TStream

What is a stream? TStream?
A stream is what its name suggests: a flowing "river of data". A stream has a beginning, an end, and you're always somewhere in between of these two points.
Using Delphi's TStream objects you can read from or write to various kinds of storage media, such as disk files, dynamic memory, and so on.
What data can a stream contain?

...use TFileStream?

type
 
  TPerson = record
    Name: string[50];
    vorname: string[50];
  end;
 
  TComputer = record
    Name: string[30];
    cpu: string[30];
  end;
 
var
  Form1: TForm1;
 
  Person: TPerson;
  Computer: TComputer;
 
  Stream: TFileStream;
 
implementation
 
{$R *.DFM}
 
//Speichern resp. Erstellen von Datei
//Save or create the file
procedure TForm1.Button1Click(Sender: TObject);
begin
  try
    Stream := TFileStream.Create('c:\test.dat', fmOpenReadWrite);
  except
    Stream := TFileStream.Create('c:\test.dat', fmCreate);
  end;

同步内容