HB_FReadLn

HB_FReadLn

Read a line from the currently selected text file without moving the record pointer

Syntax

      HB_FReadLn() -> cLine

Argument

None

Returns

A string containing the current record in a text file

Description

HB_FReadLn() reads the current line in the currently selected text file workarea.

The record pointer is not moved.

A text file “record” is a line of text terminated by a CRLF pair.

Example

      // display each record of a text file
      HB_FUse( "test.txt" )
      DO WHILE ! HB_FEOF()
         ? HB_FReadLn()
         HB_FSkip()
      ENDDO

      * ˜˜˜˜˜˜˜˜˜˜˜˜˜˜

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

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

         nFile := HB_FUse( cFile )

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

         HB_FUse()

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

      RETURN

Seealso

HB_FAtEOF(), HB_FEof(), HB_FGoBottom(), HB_FGoto(), HB_FGoTop(), HB_FInfo(), HB_FLastRec(), HB_FReadAndSkip(), HB_FRecno(), HB_FSelect(), HB_FSkip(), HB_FUse()

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s