Autor Beitrag
HHDS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Mi 28.05.08 19:07 
Also, ich bin ja dabei eine Prog.Umgebung zu schreiben und krieg das mit dem Speichern net hin.

Ein Beispiel: Der Nutzer Erstellt ein Projekt, dass in .trcpp abgespeichert werden soll. Wie mache ich das? Wenn möglich, gleich den Ladeprozess hinterher :o

Kann sein das es sowas schonmal gab, aber ich möchte es etwas präziser hier in diesem Topic...
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 28.05.08 19:12 
Wenn du präzise Antworten willst, solltest du auch präzise Fragen stellen. ;-)

Zum Speichern gibt es viele Varianten. Das fängt bei Memo1.lines.SaveToFile an, und geht über Inifiles oder typisierte Dateien hin zu FileStreams.

Was man dann verwendet, hängt ganz davon ab, was man speichern will.

_________________
We are, we were and will not be.
HHDS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win 98, Win XP Home
Delphi 7 Personal
BeitragVerfasst: Mi 28.05.08 19:19 
Wunderbar, deine erste Möglichkeit hört sich doch gar nicht schlecht an. Gut Soll ich dann so schreiben so:

<delphi> Editor.Lines.SaveToFile := FFilename;</delphi>

Das dann FFilename entsprechend deklariert wird und ein Save-Steuerelement auf das Form ziehe und ja...?

_________________
Niemand, der nicht schlau ist, ist wirklich dumm. Sie wissen nur nicht soviel...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 28.05.08 19:25 
Erstens:
ausblenden Delphi-Quelltext
1:
Editor.Lines.SaveToFile(FFilename);					
Denn du weist keiner Variablen oder Eigenschaft einen Wert zu sondern rufst die Methode SaveToFile auf.
Zweitens: Nicht <delphi>Quelltext</delphi> sondern <span class="inlineSyntax"><span class="codecomment">{PROTECTTAG92a0c76ffc09c2c2f8a0bc326039905c}</span></span> mit eckigen Klammern. ;-)
Bethsoftfan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win XP, Linux OpenSuSE 10.3 mit Compiz Fusion :cool:
Delphi 2007 Prof. Delphi 5
BeitragVerfasst: Mi 28.05.08 20:35 
Oder um echten Zugriff, bzw. volle Kontrolle mit WriteLn(file, string) und ReadLn(file, string) :wink:

dann könnte es so aussehen :
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
...
var
f : file;
s : string;
begin
AssignFile(f, OpenDialog1.FileName); //File "öffnen"
Reset(f); // zurücksetzen

s := //what ever
WriteLn(f, s) //!eine! Zeile in Datei schreiben

{bzw.}

ReadLn(f, s) //!eine! Zeile lesen, und s zuweisen

end;
...