Autor Beitrag
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 31.03.03 19:45 
Ja, also ich hätt mal wieder ein paar Fragen
ein quelltext-example wär echt super (habs nicht so mit den begriffen)

1. Stopuhr (TTimer rückwärts?)
2. Speichern von ''array [1..10] of string'' als Datei und das selbe wieder laden;


Zuletzt bearbeitet von G-McKree am Mo 31.03.03 20:00, insgesamt 1-mal bearbeitet
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Mo 31.03.03 19:52 
Wie wäre es mal mit einer aussagekräftigen Überschrift?

1. Das würde ich nicht mit TTimer machen, da TTimer sehr ungenau ist... Such mal im Forum nach timer...
2. Zum Schreiben machst Du einfach eine Schleife und schreibst alle Werte mit writeln in eine Textdatei. Beim Auslesen machst Du es genau anders herum und liest die Werte Zeile für Zeile mir readln wieder ein.
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 31.03.03 19:55 
FriFra hat folgendes geschrieben:
2. Zum Schreiben machst Du einfach eine Schleife und schreibst alle Werte mit writeln in eine Textdatei. Beim Auslesen machst Du es genau anders herum und liest die Werte Zeile für Zeile mir readln wieder ein.

vieleicht mal ein quelltext-example?
von writeln und readln hab ich das letzte mal in turboPascal gehört
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Mo 31.03.03 20:03 
F1...

Ein Beispiel für read und write aus der Delphi-Hilfe:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
var

  F1, F2: TextFile;
  Ch: Char;
begin
  if OpenDialog1.Execute then begin
    AssignFile(F1, OpenDialog1.Filename);
    Reset(F1);
    if SaveDialog1.Execute then begin
      AssignFile(F2, SaveDialog1.Filename);
      Rewrite(F2);
      while not Eof(F1) do
      begin
        Read(F1, Ch);
        Write(F2, Ch);
      end;
      CloseFile(F2);
    end;
    CloseFile(F1);
  end;

end;


readln und writeln funktioneren im Prinzip genauso, nur dass writeln einen Zeilenumbruch ans Ende des Strings hängt und readln eine ganze Zeile ausliest...
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 31.03.03 20:06 
und wie sieht ne TextFile variable aus? c:\x.txt?
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Mo 31.03.03 20:10 
F1 :shock:
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 31.03.03 20:16 
und wie kann ich was speichern oder laden ohne extra die dialoge zu öffnen?

wie definiere ich diese TextFile variable? (ich will ihr ja ne bestimmte datei laden und nicht irgendeine)
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Mo 31.03.03 20:20 
OpenDialog1.Filename ist ein String, d.h. Du kannst es z.B. gegen 'c:\liesdochmalinderhilfe_dierichtunghastdunundoch.txt' ersetzen...
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 31.03.03 20:25 
1. mein delphi ist in english
2. auch in deutsch gibt es wohl keine verständlichen erklärungen

-> deshalb frage ich euch
MKehrer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114

NT, 2000
D6
BeitragVerfasst: Di 01.04.03 08:28 
Titel: Warum einfach, wenn auch kompliziert geht
Nimm doch statt array[] of String einen TStringList
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Button1Click(Sender: TObject);
Var stl:TStringList;
      i:Integer;
begin
  stl:=TStringList.Create;
  stl.LoadFromFile('e:\d.asc');
  For i:=0 to stl.count-1 do ShowMessage(stl[i]);
  stl.Free;
end;


außerdem gibt´s noch TStringList.SaveToFile

Manfred