Autor Beitrag
Schüler
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 183



BeitragVerfasst: Mo 10.07.06 15:12 
Hi, ich wollte wissen ob ich den Wert einer Variable speichern kann wie z.B mit dem Befehl savetofile.
Wenn ja wie, wenn nein wie kann ich diese Problem umgehen?
Mfg Lasse


Moderiert von user profile iconraziel: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 10.07.2006 um 16:16
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: Mo 10.07.06 15:14 
Du könntest ihn in eine INI schreiben oder in ein Memo laden und dann SaveToFile aufrufen.
Welcher Datentyp denn?

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



BeitragVerfasst: Mo 10.07.06 15:19 
Eine Variable selbst ist kein Objekt und hat daher auch keine Befehle wie SaveToFile(), um ihren Inhalt irgendwo hinzuschreiben. Dafür bietet sich aber zB TIniFile als 'Einstieg' an, dieses Objekt kann mit den Befehlen WriteString, WriteInteger, WriteBool etc die verschiedensten Formate in eine Datei schreiben und mit den korrespondierednen Read*-Befehlen auch wieder auslesen. Schau dir mal den Aufbau einer Ini-Datei an und die Hilfe zu TIniFile. Weitere Fragen dann gerne.

peinhard
Schüler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 183



BeitragVerfasst: Mo 10.07.06 15:29 
könnt ihr das noch ein wenig genauer erklären?
Seraph
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 163

Windows.:siXPack:.
Delphi7 Professional
BeitragVerfasst: Mo 10.07.06 15:33 
Titel: Registry
Da gibt es natürlich noch die Möglichkeit,
die Werte deiner Variablen in dei Registry zu speichern!

Hat aber zur Folge, dass jede weitere Instanz deines Programms, auf demselben Pfad basiert!

Wenn es um Strings (text) geht, dann benutze doch einfach das Objekt: TStringList!

Das kann auch .SaveToFile()!


Gruß
Seraph
Seraph
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 163

Windows.:siXPack:.
Delphi7 Professional
BeitragVerfasst: Di 11.07.06 07:35 
Das Beispiel zur StringList währe:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.FormCreate(Sender: TObject);
var
 SList: TStringList;
begin
 SList := TStringList.Create;

 SList.Text := 'Bla Test Bla' + #13 + 'Bla bla';

 SList.SaveToFile('C:\Test.txt');
end;