cFileNameComplete test path in the execution context.
AdvPL GuideFWFileReader():New(cFileName, [xBreakLine])Reads text files line by line with buffering.
Use HasLine with GetLine: EOF is documented for byte reading. Buffered lines can remain after physical EOF. FullRead and GetAllLines need memory planning; getBytesRead counts bytes fetched into the buffer. The example receives a prepared complete path and counts lines without logging contents. Close follows successful opening on the normal path; application exception handling must ensure cleanup on unexpected failures too. (Sources: refs. 1–1.)
FWFileReader():New(cFileName, [xBreakLine])cFileNameComplete test path in the execution context.
xBreakLineOptional line separator.
o:Open() / o:Close()o:HasLine() --> lHasLineo:GetLine([lReturnCr]) --> cLineo:FullRead() --> cBuffer// Fragment: cPath is a validated complete test path.
oReader := FWFileReader():New(cPath)
nLines := 0
If oReader:Open()
// Use HasLine to consume GetLine.
While oReader:HasLine()
cLine := oReader:GetLine()
nLines++
EndDo
oReader:Close()
EndIf
FreeObj(oReader)Count depends on the file; no fixed line count. 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.