Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Quellcode klappt nicht (https://www.delphipraxis.net/44336-quellcode-klappt-nicht.html)

Alexander Roth 18. Apr 2005 07:33


Quellcode klappt nicht
 
Wieso klappt dieser doch sehr einfache Quelltext nicht?

Delphi-Quellcode:
procedure intxtschreiben(pfad,text:string;einmalig:boolean);
var txt:textfile;
begin
assignfile(txt,pfad);
if fileexists(pfad) then reset(txt) else rewrite(txt);
writeln(txt,inttostr(lauf));
closefile(txt);
end;

Compilieren tut er das gut, aber beim ausführer maktiert er die Zeile mit writeln und meldet:
---------------------------
Debugger Exception Notification
---------------------------
Project Corioliskraft.exe raised exception class EInOutError with message 'I/O error 105'. Process stopped. Use Step or Run to continue.
---------------------------

Hinweis lauf eristiert und die Variablen wurden alle ordnungsgemäß zugewiesen.

toms 18. Apr 2005 07:44

Re: Quellcode klappt nicht
 
Hallo!

Muesste so funktionieren:

Delphi-Quellcode:
procedure intxtschreiben(pfad, Text: string);
var
  txt: TextFile;
begin
  AssignFile(txt, pfad);
  if fileexists(pfad) then
    Append(txt)
  else
    Rewrite(txt);
  Writeln(txt, IntToStr(123));
  Closefile(txt);
end;

Alexander Roth 18. Apr 2005 07:46

Re: Quellcode klappt nicht
 
Wow. Es klappt.
Wo ist denn der Unterschied zwischen reset und append?

Sharky 18. Apr 2005 07:49

Re: Quellcode klappt nicht
 
Zitat:

Zitat von Alexander Roth
Wow. Es klappt.
Wo ist denn der Unterschied zwischen reset und append?

Zitat:

Append
Öffnet eine vorhandene Textdatei zum Anhängen von Daten.

Reset
Öffnet eine vorhandene Datei

Alexander Roth 18. Apr 2005 09:22

Re: Quellcode klappt nicht
 
Danke.
Klappt alles wunderbar.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:55 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz