: I still dont see how
:
: will let me assign the generated date and time as the filename.
: If I defined (useing ':=') "Filename" as 'somefile.txt' this makes Filename no less of a "variable" (ie something that changes) than If I simply went along and used the
:
:
: If I code
:
:
: The compiler says 'Error 2: File not Found"
You're right, but since the file is non-existant, that's where you get your error. The file HAS to exist to use Append();
This is a safer way that should always be used:
Phat Nat
:
: Filename := 'somefile.txt'; : Assign(f, Filename); :
: will let me assign the generated date and time as the filename.
: If I defined (useing ':=') "Filename" as 'somefile.txt' this makes Filename no less of a "variable" (ie something that changes) than If I simply went along and used the
:
Assign(f, 'somefile.txt')version.
:
: If I code
:
: Assign(F, Filename) {Where Filename is the generated date and time} : Append(F) :
:
: The compiler says 'Error 2: File not Found"
You're right, but since the file is non-existant, that's where you get your error. The file HAS to exist to use Append();
This is a safer way that should always be used:
Assign(F,FileName); {$I-} { Return Error Code instead of Halting program } Append(F); IF IOResult <> 0 Then { If there was an error, like File Not found...} Rewrite(F); { ...then create the file. } {$I+} { I like to do this, but you can just compile } { whole program in the $I- state. }
Phat Nat