In Delphi (10.3) is there a way to test if a text file was opened via Rewrite or via Append?
I've found this:
Checking File is Open in Delphi
but it doesn't help as it only says if file is opened for Read or Write.
Note that I can use a global Boolean, initialized to True if I open the file as Append, and to False if Rewrite, but I'm curious to know if the is another way.
CodePudding user response:
TTextRec(txt).Mode
is fmOutput
for Rewrite
and fmInOut
for Append
(look in system.pas
)