Kill (shut down the ASCIIFileClass object)

Top  Previous  Next

 

Kill

The Kill method frees any memory allocated during the life of the object and performs any other required termination code.

Example:

Filename    STRING(255),THREAD             !declare filename variable

FileActive  BYTE                           !declare success/fail switch

AsciiFile   FILE,DRIVER('ASCII'),NAME(Filename),PRE(A1)

RECORD       RECORD,PRE()

Line          STRING(255)

            END

           END

CODE                                      !init ASCIIFileClass object with:

FileActive=ASCIIFile.Init(AsciiFile, |    ! file label

             A1:Line,                |    ! file field to display

             Filename,               |    ! NAME attribute variable

             GlobalErrors)                ! ErrorClass object

IF ~FileActive THEN RETURN.               !If init failed, don't proceed

ACCEPT                                    !If init succeeded, proceed

 IF EVENT() = EVENT:CloseWindow

  IF FileActive THEN ASCIIFile.Kill.      !If init succeeded, shut down

 END

 !program code

END