Einzelnen Beitrag anzeigen

Benutzerbild von Matze
Matze
(Co-Admin)

Registriert seit: 7. Jul 2003
Ort: Schwabenländle
14.929 Beiträge
 
Turbo Delphi für Win32
 
#18

Re: Stress mit Record aber warum?

  Alt 12. Apr 2007, 15:08
Das Beispiel von ErazerZ mit Jellys Änderungen funktioniert bei mir ohne Probleme (mal die komplette Unit):

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
    type
      THistoryData = record
      FileName: string;
      OldSize, NewSize: int64;
    end;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  HistoryData: array of THistoryData;
  i: Integer;
  s: string;
begin
  SetLength(HistoryData, 20);

  // Array füllen
  for i := Low(HistoryData) to High(HistoryData) do
    HistoryData[i].FileName := 'Hallo';

  // Array ausgeben
  for i := Low(HistoryData) to High(HistoryData) do
    s := s + HistoryData[i].FileName + #13#10;
  ShowMessage(s);
end;

end.
  Mit Zitat antworten Zitat