Einzelnen Beitrag anzeigen

ter

Registriert seit: 26. Aug 2017
17 Beiträge
 
Delphi 6 Personal
 
#10

AW: Wo soll das FileMode im Quellcode hin?

  Alt 5. Jul 2019, 16:04
Danke fuer die vielen Antworten.

Aus meiner Delphi 6 Hilfe erfahre ich
ueber "FileMode" folgendes:

---
Indicates the access mode on typed and untyped files
opened by the Reset procedure.

Unit

System

Category

I/O routines

var FileMode: Byte = 2;

Description

The FileMode variable determines the access mode to
use when typed and untyped files (not text files)
are opened using the Reset procedure.

The default FileMode is 2 (Read/Write access).
Assigning another value to FileMode causes all
subsequent Resets to use that mode. The SysUtils
unit declares a number of file open mode constants
that can be assigned to the FileMode variable.

Note: Be sure to reset FileMode before calling
Reset with a read-only file. Even if you are only
reading from the file, the default FileMode value
(Read/Write access) will cause an attempt to open
a read-only file to fail.

Warning: FileMode is declared as a variable,
not as a threadvar. Therefore this variable is not
thread-safe.
---

Leider kann ich nirgendswo feststellen, an welcher
Position es zu stehen hat. Default ist immer
FileMode:=fmOpenReadWrite;
gesetzt.

Bei der Verwendung von Append(T), also dem Oeffnen
einer Textdatei, var T : TextFile;, steht Append(T)
nach dem Reset(T). Hier muss FileMode:=fmOpenWrite;
gesetzt werden.

Da ich in meinem Programm aber mehrere TextDateien
oeffne, muss ich den Wert im FileMode oefters aendern.

Gruss Terence
Terence Coman
  Mit Zitat antworten Zitat