HB_FRecNo
Return the current line / record number of a text file
Syntax
HB_FRecNo() -> nRecNo
Argument
None
Returns
HB_FRecNo() returns the current record number of a text file or 0 if no file is open.
Description
This function returns the current record number of the file open in the currently selected text file workarea.
A text file “record” is a line of text terminated by a CRLF pair.
Example
HB_FUse( "test.txt" ) // open text file DO WHILE !HB_FEOF() ? HB_FReadLn() // read a line / record HB_FSkip() // go to next line / record ENDDO HB_FGoTop() // go to top of file ( first line / record ) ? HB_FRecNo() // 1 *˜˜˜˜˜˜˜˜˜˜˜˜˜˜ // The example lists the lines of a text file along with // their line numbers PROCEDURE Main LOCAL cFile := "text.txt" nFile := HB_FUse( cFile ) DO WHILE .NOT. HB_FEof() ? "Line #" + LTRIM( STR( HB_FRecno() ) ), HB_FReadLN() HB_FSkip(1) ENDDO HB_FUse() RETURN
Seealso
HB_FAtEOF(), HB_FEof(), HB_FGoBottom(), HB_FGoto(), HB_FGoTop(), HB_FInfo(), HB_FLastRec(), HB_FReadAndSkip(), HB_FreadLN(), HB_FSelect(), HB_FSkip(), HB_FUse()