Autor Beitrag
Jojojoxx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mi 09.11.05 23:54 
Hallo!

Kann mir einer sagen, warum dieser Versuch fehlschlägt mit der Meldung "Ungültiger Typ in Write/WriteLn-Anweisung"??
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
type
   Feldtyp=Array[1..3,1..3] of String[40];
   dateityp=File of Feldtyp;
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
Array1:Feldtyp;
f:Dateityp;
Datei:Textfile;

begin
Array1[1,1]:='Test1';
Array1[1,2]:='Test2';
Array1[1,3]:='Test3';

Array1[2,1]:='Test1';
Array1[2,2]:='Test2';
Array1[2,3]:='Test3';

Array1[3,1]:='Test1';
Array1[3,2]:='Test2';
Array1[3,3]:='Test3';

AssignFile(Datei, 'A:\Testdat.ini');
ReWrite(Datei);
Write(Datei, f);
CloseFile(Datei);

end;
end.


Danke euch!

mfg

Jojo

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
juKx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45

WinXp Pro Sp2
Delphi 7 Enterprise Edition
BeitragVerfasst: Do 10.11.05 00:07 
hi,

ist es icht so das du bei rewrite die datei immer wieder überschreibst?!
probiere es mal hiermit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
assignfile(datei,'A:\datei');
if FileExists('A:\datei') then
  Reset(datei)
else
  ReWrite(datei);



und deine variable "datei" von dateityp sein.

ich hoffe es klappt :)

gruß juKx

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 10.11.05 00:14 
Hi!

Danke für deine Antwort!

Ich dachte immer Reset bedeutet "Öffnen für Lesezugriff" und ReWrite bedeutet "Öffnen für Schreibzugriff"??

mfg

Jojo
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Do 10.11.05 03:59 
du hast da was durcheinandergebracht
ausblenden Delphi-Quelltext
1:
2:
3:
4:
AssignFile(f, 'A:\Testdat.ini');   
ReWrite(f);   
Write(f, Array1);   
CloseFile(f);

datei kannste ganz schmeissen
und ja, reset öffnet vorhandenes zum lesen, rewrite erstellt was neues, und append hängt an vorhandenes an.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Do 10.11.05 16:47 
@retnyg: Danke dir, habs vorhin auch rausgefunden! :-)

mfg

Jojo