| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Reads the current line and moves the record pointer.
HB_FReadAndSkip() --> cLine
The function returns the current line in the currently selected text file as a character string.
HB_FReadAndSkip() reads the current line in the currently selected text file and advances the record pointer to the next line. The function is especially designed for reading CSV files that may contain quoted Carriage return, Line feed characters (CRLF). CRLF characters are not recognized as end-of-line markers when they are part of a quoted character string.
| See also: | FOpen(), FSeek(), HB_FReadLine(), HB_FReadLN(), HB_FSelect(), HB_FUse() |
| Category: | File functions , Text file functions , xHarbour extensions |
| Source: | misc\hb_f.c |
| LIB: | libmisc.lib |
// The example fills an array with the lines of a text file,
// taking advantage of implicit record pointer movement of
// function HB_FReadAndSkip().
PROCEDURE Main
LOCAL cFile := "Textfile.txt"
LOCAL aLines, nLine := 0, nCount
LOCAL nFile
nFile := HB_FUse( cFile )
nCount := HB_FLastRec() + 1
aLines := Array( nCount )
DO WHILE ++nLine <= nCount
aLines[ nLine ] := HB_FReadAndSkip()
ENDDO
HB_FUse()
AEval( aLines, {|cLine| QOut( cLine ) } )
RETURN
http://www.xHarbour.com