nHandleValid handle to close, explicitly supplied in this example.
AdvPL GuideFClose( [nHandle] ) --> lRetCloses a file handle owned by the routine.
FClose returns true on closure and false on failure; consult FError after failure for details. A file handle is not a table alias. The community example creates a file first; this adaptation opens an existing test file read-only, accepts handle zero and closes on the normal path. An absent file produces an open diagnostic without creating a replacement. (TOTVS, n.d., ref. 1)
FClose( [nHandle] ) --> lRetnHandleValid handle to close, explicitly supplied in this example.
Logical closure success.
#Include "Protheus.ch"
#Include "Fileio.ch"
User Function Ed378()
Local nHandle := FOpen("editorial-test.txt", FO_READ + FO_SHARED)
// Handle zero is valid; do not require greater than zero.
If nHandle >= 0
If !FClose(nHandle)
ConOut(cValToChar(FError()))
EndIf
Else
ConOut(cValToChar(FError()))
EndIf
Return NilCloses after successful opening; failures report a code without file content. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.