Autor Beitrag
AlexBegin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Do 20.12.07 11:06 
Ich müsste für mein Programm eine einzeilige Text-Datei direkt in eine Variabel laden. Hier im Forum finde ich nur Lade-Routinen für Edit,Memo usw... Kann mir jemand verraten ob es möglich ist direkt in eine Variabel eine Text-Datei zu laden.

Bis dan Alex
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Do 20.12.07 11:13 
Ja!

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 20.12.07 11:16 
Ich tippe es mal aus dem Kopf:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  F: TextFile;
  V: String;
begin
  AssignFile(F, 'Deine-Datei');
  Reset(F);
  ReadLn(F,V);
  CloseFile(F);
  ShowMessage(V);
end;
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Do 20.12.07 11:24 
ich würde aber trotzdem
var sl: TStringList;

und dann

sl.LoadFromFile('filename.txt');

das ist auch eine Variable, nur dass du sie hald erstellen musst. Aber so ist es objektorientierter und der Text besser zu bearbeiten.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 20.12.07 11:37 
Das ist dann wieder die Sache mit den Kanonen und den Spatzen.
AlexBegin Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Sa 22.12.07 15:13 
Danke jasocul, funktioniert einwandfrei.

Bis dann Alex