HB_FUse

HB_FUse

Open or close a text file for use by the HB_F* functions

Syntax

      HB_FUse( [ <cFile> ] [, <nMode> ] ) -> nHandle | NIL

Arguments

<cFile> : is the text file you want to open. If not specified, the file currently open, if any, will be closed.

<nMode> : is the open mode for the file. Please refer to the discussion of open modes under FOPEN() and FILEIO.CH for a list of allowable open modes. If not specified, the file will be opened with a mode of FO_READ + FO_SHARED (64).

Returns

If <cFile> is passed and the file is opened successfully, an integer containing the file handle. If the file cannot be opened, -1 will be returned.

If HB_FUse() is called without any arguments, it will close the text file in the current “text area” and return NIL.

Description

Some of HB_F*() file functions are for reading text files, that is, files where each line (record) is delimited by a CRLF pair.

Each file is opened in its own “workarea”, similar to the concept use by dbf files. As provided, a maximum of 10 files (in 10 workareas) can be opened (assuming there are sufficient file handles available).

Example

      HB_FUse( "test.txt" )      // open text file
      DO WHILE ! HB_FEOF()
         ? HB_FReadLn()
         HB_FSkip()
      ENDDO
      HB_FUse()                // close file

Seealso

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

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