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_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_FAPPEND

FT_FAPPEND()
 Appends a line to the currently selected text file

 Syntax

      FT_FAPPEND( [ < nLines > ] ) -> NIL

 Arguments

     <nLines> is the number of lines that should be appended to the
     end of the currently selected text file.

     If <nLines> is omitted, one record is appended.

 Returns

     NIL

 Description

     This function appends 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 moved to the last appended
     record.

     Multiple lines may be appended with one call to FT_FAPPEND().

     A text file "record" is a line of text terminated by a CRLF pair.
     Each line appended with this function will be empty.

     NOTE:  Occasionally a text file may contain a non-CRLF terminated
     line, at the end of the file ("stragglers").  This function assumes
     these stragglers to be the last line of the file, and begins
     appending the new lines after this line.  In other words, if the
     last line in the text file is not terminated with a CRLF pair prior
     to calling FT_FAPPEND(), the function will terminate that last line
     before appending any new lines.

 Examples

     // add a blank line of text to a file
     FT_FUSE( "test.txt" )

     ?FT_FRECNO()           // displays 5

     FT_FAPPEND()

     ?FT_FRECNO()           // displays 6

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

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