FT_PEGS

FT_PEGS()
 FT_PEGS GAME (all work and no play...)

 Syntax

      FT_PEGS() -> NIL

 Arguments

     None

 Returns

     NIL

 Description

     This function can be used to alleviate boredom.  The object is to
     remove all pegs except one.  This is done by jumping over adjacent
     pegs.

 Examples

     FT_PEGS()

 Source: PEGS.PRG

 Author: Greg Lief

 

FT Text File Management

 FT_DFCLOSE()     Close file displayed by FT_DISPFILE()
 FT_DFSETUP()     Set up parameters for FT_DISPFILE()
 FT_DISPFILE()    Browse a text file
 FT_FAPPEND()     Appends a line to the currently selected text file
 FT_FDELETE()     Deletes a line from the currently selected text file
 FT_FEOF()        Determine when end of text file is encountered
 FT_FERROR()      Return the error code for a text file operation 
 FT_FGOBOT()      Go to the last record in a text file
 FT_FGOTO()       Move record pointer to specific record in a text file
 FT_FGOTOP()      Go to the first record in a text file
 FT_FINSERT()     Inserts a line in the currently selected text file
 FT_FLASTRE()     Get the no. of records in the currently selected text file
 FT_FREADLN()     Read a line from the currently selected text file
 FT_FRECNO()      Return the current record number of a text file
 FT_FSELECT()     Select a text file workarea
 FT_FSKIP()       Move the record pointer to a new position in a text file
 FT_FUSE()        Open or close a text file for use by the FT_F* functions
 FT_FWRITELN()    Write a line to the currently selected text file

 

FT_FWRITELN

FT_FWRITELN()
 Write a line to the currently selected text file

 Syntax

      FT_FWRITELN( < cData >, [ < lInsert > ] ) -> NIL

 Arguments

     <cData> is a string of data to write to the file at the current
      record position.

     <lInsert> is a logical indicating whether the contents
     of the current record are to be preserved, that is, if lInsert
     evaluates to .T., the a new record is inserted at the current
     position.  The current record then is pushed down to FT_FRECNO()+1.

     If lInsert is .F. or omitted, the current record is replaced by
     cData.

 Returns

     NIL

 Description

     This function writes a line of text to the file in the currently
     selected text file workarea.  Text lines are delimited with a
     CRLF pair.  The record pointer is not moved.

     The contents of the current record are updated to reflect the new
     new line written, unless the Insert option is selected.

     Writing a null string has the effect of clearing the current line
     if in overstrike mode, else inserting a new line (same as
     FT_FINSERT()).

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

 Examples

     // write a line of text to a file
     FT_FUSE( "config.sys" )
     DO WHILE UPPER( FT_FREADLN() ) != "FILES=" .AND. !F_FEOF()
        FT_FSKIP()
     ENDDO

     FT_FWRITELN( "FILES=30", FT_FEOF() )

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

See Also: FT_FREADLN() FT_FRECNO() FT_FINSERT() FT_FDELETE()

FT_FUSE

FT_FUSE()
 Open or close a text file for use by the FT_F* functions

 Syntax

      FT_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() in the Clipper manual
     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 FT_FUSE() is called without any arguments, it will close the
     text file in the current "text area" and return NIL.

 Description

     The FT_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).  That number may be increased by modifying
     the #define TEXT_WORKAREAS in the C source code and recompiling.

 Examples

     FT_FUSE( "text.c" )      // open text file
     DO WHILE !FT_FEOF()
        ? FT_FREADLN()
        FT_FSKIP()
     ENDDO
     FT_FUSE()                // close file

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

See Also: FT_FUSE() FT_FSELECT()

FT_FSKIP

FT_FSKIP()
 Move the record pointer to a new position in a text file

 Syntax

      FT_FSKIP( [ <nLines> ] ) -> NIL

 Arguments

     <nLines> is the number of lines to skip.  Defaults to 1 if
     not specified.

 Returns

     NIL

 Description

     This function moves the text file record pointer, similar to
     the CLIPPER SKIP command.

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

 Examples

     // display each record of a text file
     FT_FUSE( "text.c" )
     DO WHILE ! FT_FEOF()
        ? FT_FREADLN()
        FT_FSKIP()
     ENDDO

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

See Also: FT_FRECNO() FT_FGOTOP()

FT_FSELECT

FT_FSELECT()
 Select a text file workarea

 Syntax

      FT_FSELECT( [ <nArea> ] ) -> nArea

 Arguments

     <nArea> is the text file workarea to select.

 Returns

     The current selected text file area.

 Description

     This function selects a text file "workarea" from 1 to 10.  A
     file may or may not be open in the selected area.

     Passing 0 for <nArea> selects the next available workarea, similar
     to Clipper's SELECT 0 command.

     Each file is opened in its own "workarea", similar to the concept
     used by dbf files.  As provided, a maximum of 10 files (in 10
     workareas) can be opened (assuming there are sufficient file
     handles available).  That number may be increased by modifying
     the #define TEXT_WORKAREAS in the C source code and recompiling.

     All the FT_F*() file functions operate on the file in the currently
     selected text file workarea.

     Text file workareas are separate from and independent of Clipper's
     database workareas.

 Examples

     FT_FSELECT(1)
     nFile1 := FT_FUSE( "temp.c" )
     ? FT_FLASTRE()                 // no. of lines in temp.c
     FT_FSELECT(2)
     nFile2 := FT_FUSE( "temp.h" )
     ? FT_FLASTRE()                 // no. of lines in temp.h

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

See Also: FT_FUSE()

FT_FRECNO

FT_FRECNO()
 Return the current record number of a text file

 Syntax

      FT_FRECNO() -> nRecNo

 Arguments

     None

 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.

 Examples

     FT_FUSE( "text.c" )      // open text file
     DO WHILE !FT_FEOF()
        ? FT_FREADLN()        // read thru file
        FT_FSKIP()
     ENDDO
     FT_FGOTOP()              // go back to top
     ? FT_FRECNO()            // 1

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

See Also: FT_FSELECT() FT_FUSE() FT_FGOTOP() FT_FGOBOT()

FT_FREADLN

FT_FREADLN()
 Read a line from the currently selected text file

 Syntax

      FT_FREADLN() -> cLine

 Arguments

     None

 Returns

     A string containing the current record in a text file.

 Description

     This function returns a line of text read from the file in the
     currently selected text file workarea.  Text lines are delimited
     with a CRLF pair.  The record pointer is not moved.

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

 Examples

     // display each record of a text file
     FT_FUSE( "text.c" )
     DO WHILE ! FT_FEOF()
        ? FT_FREADLN()
        FT_FSKIP()
     ENDDO

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

See Also: FT_FUSE() FT_FWRITELN() FT_FRECNO() FT_FGOTOP()

FT_FLASTRE

FT_FLASTRE()
 Get the no. of records in the currently selected text file

 Syntax

      FT_FLASTRE() -> nLastRecordNum

 Arguments

     None

 Returns

     An integer containing the number of records in the text file in
     the currently selected text file workarea, or zero if no file
     is currently open in the workarea.

 Description

     This function returns the number of the last record in a text file.

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

 Examples

     FT_FUSE( "text.c" )
     ? FT_FLASTRE()

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

See Also: FT_FUSE() FT_FRECNO()