Autor Beitrag
schlumsch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

alles Win :)
Delphi 2005 Prof, Delphi 2007
BeitragVerfasst: Fr 02.07.04 11:34 
Hi,

habe da ein kleines Problem welches ich nicht gelöst bekomme.
Versuche eine Textdatei auf ihre Existenz zu prüfen und bekomme bei folgendem Code folgenden Error:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Var datei : Textfile;
.
.
.
assignfile(datei,PagesDlg.DirectoryListBox1.directory + '\bla.txt');
if fileexists(datei) then append(datei)
else rewrite(datei);
.
.



Fehler: [Fehler] Unit1.pas(138): Inkompatible Typen: 'String' und 'Text'


... wo is da der Haken?


mfg Schlumsch


Moderiert von user profile iconPeter Lustig: Delphi-Tags hinzugefügt.

_________________
icq 102779206
"God is real, unless declared integer..."
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Fr 02.07.04 11:39 
FileExists erwartet den Namen einer Datei. Es muss also z.B. so aussehen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  Filename: String;
  datei: Textfile;
begin
  Filename := 'C:\my.txt';
  if FileExists(Filename) then
  begin
    AssignFile(datei, Filename);
    //...
  end;
end;

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind
schlumsch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

alles Win :)
Delphi 2005 Prof, Delphi 2007
BeitragVerfasst: Fr 02.07.04 11:52 
Hehe - Murphy - genau das hab ich eben auch gemacht und es geht.
thx anyway

schlumsch

_________________
icq 102779206
"God is real, unless declared integer..."