Einzelnen Beitrag anzeigen

EMS

Registriert seit: 19. Dez 2012
97 Beiträge
 
#10

AW: Bekomm das mit den Records nicht hin?

  Alt 19. Dez 2012, 12:30
Hallo
bin jetzt nen Programm weiter und neues Problem...

Delphi-Quellcode:
 unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;

type

  { TForm1 }

  TForm1 = class(TForm)
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

type
  TZiel = record
    Ort: String;
    Preis: real;
  end;
type
  TZielliste = record
  Ziele: array[1..100] of TZiel;
  ZielZahl: integer;
 end;

TZielFile = file of TZiel;

var
  Form1: TForm1;
  ZielListe: TZielliste;
  ZielFile: TZielfile;
  I: integer;


implementation

{$R *.lfm}

{ TForm1 }

procedure ZieleErfassen(var Liste: ZielListe);
begin
  with Liste do begin
    Ziele[1].Ort:='Dresden';
    Ziele[1].Preis:=16.00;
    with Ziele[2] do begin
      Ort := 'Berlin';
      Preis := 43.00;
    end;
  with Ziele[3] do begin
     Ort :='Aachen';
     Preis := 155.00;
  end;
  ZielZahl :=3;
  end;
end;

begin
ZieleErfassen(ZielListe);
Assign(Zielfile, 'C:\Users\Notebook\Desktop\ziele.dat');
Rewrite(Zielfile);
with ZielListe do
   for I := 1 to ZielZahl do
      write(ZielFile, Ziele[I]);
   Close(ZielFile);
end;

end.

Wo ist denn jetzt schon wieder der Fehler?
Irgendwie weiß ich nicht so recht wo das
TZielFile = file of TZiel hin muss?
  Mit Zitat antworten Zitat