xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_FreadLN()

Reads the current line and without moving the record pointer.

Syntax

HB_FreadLN() --> cCurrentLine

Return

The function returns the current line in the currently selected text file as a character string.

Description

HB_FreadLN() reads the current line in the currently selected text file and leaves the record pointer unchanged. The current line is the posrtion of the text file beginning at the file pointer position up to the next Carriage return, Line feed pair.

Use function HB_FSkip() to advance the record pointer to the next line.

Info

See also:FOpen(), FSeek(), HB_FReadAndSkip(), HB_FReadLine(), HB_FSkip(), HB_FSelect(), HB_FUse()
Category: File functions , Text file functions , xHarbour extensions
Source:misc\hb_f.c
LIB:libmisc.lib

Example

// The example fills an array with the lines of a text file,
// by skipping through the entire file.

   PROCEDURE Main
      LOCAL aLines := {}
      LOCAL cFile  := "Textfile.txt"
      LOCAL nFile

      nFile := HB_FUse( cFile )

      DO WHILE .NOT. HB_FEof()
         AAdd( aLines, HB_FReadLN() )
         HB_FSkip(1)
      ENDDO

      HB_FUse()

      AEval( aLines, {|cLine| QOut( cLine ) } )
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe