![]() |
Re: filecreate produziert e/a-32
Evtl. wartet Delphi bei "FileCreate" nicht auf dessen Fertigstellung (ist ne API-Fkt.), und geht einfach wieter im Code, und die Datei ist noch nicht "ganz fertig" wenn du schon reinschreiben willst. Aber bei "rewrite" wartet er schon. Klingt zumindest danach!
|
Re: filecreate produziert e/a-32
Zitat:
Delphi-Quellcode:
constructor TTypedFile.Create(Filename : string);
var Data : TRecord; begin AssignFile(f, Filename); { if exits open it } if FileExists(Filename) then begin //FileMode := fmShareExclusive; Reset(f); end { if not rewrite it } else begin {$I-} Rewrite(f); if IOResult <> 0 then begin RaiseLastOSError; {$I+} CloseFile(f); exit; end; FillChar(Data, sizeof(Data), #0); Data.Index := 0; { write the first emtpy record with the MaxID-Value } write(f, Data); end; { get the number of records } FRecordsCount := FileSize(f); end; |
Re: filecreate produziert e/a-32
was hälst du von FileClose?
Delphi-Quellcode:
filecreate(); übergibt das handle der erstellten datei und mit fileclose kannste dann die spezielle datei schließen. :-D
procedure TForm1.Button1Click(Sender: TObject);
var k: integer; begin k:=filecreate('Termine.txt'); FileClose(k); end; antwort kommt ein bisschen spät, aber ich hatte das selbe prob und deswegen hier mal für alle meine mitstreiter :P |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:21 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