FUNCTIONS CORE

FileError()

Read the last file-operation status

Syntax

Signature
FileError() --> nError

Return value

0 for success or a nonzero file error code.

Description

This call reads the same status as FError() and leaves it intact. Read it immediately after the file operation you are checking because another operation can overwrite it. The runtime reports argument errors separately.

Example

FileError.prg
PROCEDURE Main()

   LOCAL cName := ""
   LOCAL pFile := FileTemp( @cName )

   IF pFile == NIL
      QOut( FileError() )
      RETURN
   ENDIF

   FileClose( pFile )
   IF ! FileClose( pFile )
      QOut( FileError() ) // 6: the resource is already closed
   ENDIF
   FErase( cName )

RETURN

See also