Syntax
FileOpen( cFileName, [nMode := FO_READ + FO_COMPAT] ) --> pHandle | NILArguments
cFileName
Path to an existing file.
nMode
Access and sharing flags from fileio.ch. The default opens the file for reading in compatibility sharing mode.
Return value
A managed file resource on success, or NIL on failure. Read FileError() for the I/O status.
Description
Pass the resource to FileRead(), FileWrite(), FileSeek() or FileClose(). Copies share the current file position and closed state. Close the resource explicitly when finished.
Header
fileio.ch
Example
PROCEDURE Main()
LOCAL cName := ""
LOCAL pFile := FileTemp( @cName )
IF pFile == NIL
QOut( FileError() )
RETURN
ENDIF
FileClose( pFile )
pFile := FileOpen( cName )
IF pFile == NIL
QOut( FileError() )
ELSE
QOut( FileClose( pFile ) )
ENDIF
FErase( cName )
RETURN