Autor Beitrag
s4lzh3r1ng
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 27.02.03 14:46 
Hallo zusammen!

Kann mir jemand sagen ob es irgendwie möglich ist mit dem Befehl
write mehrere Variablenwerte in eine Datei zu schreiben oder ob das nur möglich ist, wenn ich einen record deklariere und den in die Datei schreibe.
Hier ein Beispiel:
ausblenden Quelltext
1:
write(f,flaeche,vsm,vs,vk);					

oder
ausblenden Quelltext
1:
write(f,messwerte)					


vielen Dank für eure Hilfe.

_________________
:wink: s4lzh3r1ng :wink:
maximus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 896

Win XP, Suse 8.1
Delphi 4/7/8 alles prof
BeitragVerfasst: Do 27.02.03 18:34 
Na klar geht das!
ausblenden Quelltext
1:
2:
3:
var f: file of integer;
...
for i := bla to bla do write(f,i);


...einfach mal testen.

mfg mx
s4lzh3r1ng Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 27.02.03 22:06 
vielen Dank erstmal, aber ich glaub das ist nicht das ws ich meine, ich möchte ja verschiedene Variablen abspeichern und nicht nur eine.
Denn das ist das Problem wenn ich mehrer da hinschreibe, nimmt er trotzdem nur den ersten.
Weiß da jemand weiter?

_________________
:wink: s4lzh3r1ng :wink:
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Do 27.02.03 23:42 
Was maximus geschrieben hat, ist schon das was Du suchst.
s4lzh3r1ng Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Fr 28.02.03 13:25 
:oops: Stimmt ... entschuldigt bitte, hab das erst nicht richtig kapiert.

Vielen Dank!

_________________
:wink: s4lzh3r1ng :wink:
Corelgott
Hält's aus hier
Beiträge: 5



BeitragVerfasst: Fr 28.02.03 18:40 
Titel: Speichern...
:idea:
Man kann in delphi doch auch eigene Daten-Typen Speichern:
8)

ausblenden 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:
type TData = record
     Name, Vorname: String [255];
end;

...

var
  Data : Array of TData;

...

procedure SaveFile(Path : String);
var
   IndX : Integer;

begin
     assignFile(MyFile,Path);
     if fileExIsts(Path) then
         reset(MyFile)
     else
         rewrite(MyFile);
     for IndX := 0 to count-1 do write(MyFile,Data[IndX]);
     closeFile(MyFile);
end;


Das laden geht dann ähnlich leicht:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
Procedure LoadFile(Path : String);
var
  tmp : TData;
begin
     if fileExIsts(Path) then
     begin
       Clear;
       assignFile(MyFile,Path);
       reset(MyFile);
       while not EOF(MyFile) do
       begin
          read(MyFile, tmp);
          Add(tmp); //Da müsste dann ne Prozedur hin, die das Array vergrößert usw...
       end;
       closeFile(MyFile);
     end;
end;


Nur ne Ergänzung zum speichren :D