Autor Beitrag
Redrah
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24

Win XP
D6, Turbo Delphi
BeitragVerfasst: So 15.10.06 13:54 
Hey Leutz,
ich hätte mal ne frage und zwar:
Ich möchte den aktuellen Zustand eines Array in einer Datei abspeichern.
Und da sich das Array öfters ändert, muss ich viele Dateien abspeichern.
Nun zu meinen Problemen:
Wie kann ich beim Speichern in eine Datei den Dateinamen mit einer fortlaufende Nummer, der sich dann erhöhen kann, ausstatten.
Vielen Dank für eure Hilfe und Antwort.
bye Daniel
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 15.10.06 13:57 
In einer for-Schleife alles durchgehen und die Zählvariable in den Dateinamen einbauen. ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Redrah Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24

Win XP
D6, Turbo Delphi
BeitragVerfasst: So 15.10.06 14:19 
muss dann das so aussehen oder wie?
For i:=1 To 10 Do
begin
AssignFile (Ergebnis,'Punkte[i].txt');
...
end;
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: So 15.10.06 14:35 
user profile iconRedrah hat folgendes geschrieben:
Hey Leutz,
ich hätte mal ne frage und zwar:
Ich möchte den aktuellen Zustand eines Array in einer Datei abspeichern.
Und da sich das Array öfters ändert, muss ich viele Dateien abspeichern.
Nun zu meinen Problemen:
Wie kann ich beim Speichern in eine Datei den Dateinamen mit einer fortlaufende Nummer, der sich dann erhöhen kann, ausstatten.
Vielen Dank für eure Hilfe und Antwort.
bye Daniel


Hallo,

das ist an sich kein Problem:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var VNum : integer;
           VNStr : string[32];
...
VNum := VNum + 1;
Str (VNum:2,VNStr);
NextFileName := 'Array_Version_' + VNStr + '.Dat';


Das Problem ist nur, dass du VNum irgendwo speichern must. Um das zu umgehen, könntest du in ähnlicher Weise auch Datum und Uhrzeit anhängen.

Gruss Reinhard
Redrah Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24

Win XP
D6, Turbo Delphi
BeitragVerfasst: So 15.10.06 14:51 
Eine Frage noch:
Was machst du in dieser Zeile
Str (VNum:2,VNStr);
?
Redrah Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24

Win XP
D6, Turbo Delphi
BeitragVerfasst: So 15.10.06 15:14 
@ Reinhard Kern
Dankeschön für die tolle Hilfe!
Es Funktioniert!