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_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_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()

FT_FGOBOT

FT_FGOBOT()
 Go to the last record in a text file

 Syntax

      FT_FGOBOT() -> NIL

 Arguments

     None

 Returns

     NIL

 Description

     This function moves the record pointer to the last record of the
     file in the currently selected text file workarea.

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

 Examples

     // read last line
     FT_FUSE( "text.c" )
     FT_FGOBOT()
     ? FT_FREADLN()

 Source: FTTEXT.C

 Author: Brice de Ganahl and Steve Larsen

See Also: FT_FSELECT() FT_FUSE() FT_FGOTOP() FT_FRECNO() FT_FREADLN()

FT_DISPFILE

FT_DISPFILE()
 Browse a text file

 Syntax

      FT_DISPFILE() -> cExitkey

 Arguments

     None

 Returns

     The ASCII keystroke that terminated FT_DISPFILE()

 Description

     This routine displays a text file within a defined window using as
     little memory as possible.  The text file to display has to be
     present or an error value of 0 is returned (as a character.)

     Assumptions: The routine assumes that all lines are terminated
                  with a CR/LF sequence (0x0d and 0x0a).

     Note:        Make sure you allocate a buffer large enough to hold
                  enough data for the number of lines that you have
                  in the window.  Use the following formula as a
                  guideline - buffer size = (# of line) + 1 * RMargin
                  this is the smallest you should make the buffer and
                  for normal use I recommend 4096 bytes.

     Cursor Keys: Up, Down    - moves the highlight line
                  Left, Right - moves the window over nColSkip col's
                  Home        - moves the window to the far left
                  End         - moves the window to the nRMargin column
                  PgUp, PgDn  - moves the highlight one page
                  Ctrl-PgUp   - moves the highlight to the file top
                  Ctrl-PgDn   - moves the highlight to the file bottom
                  Ctrl-Right  - moves the window 16 col's to the right
                  Ctrl-Left   - moves the window 16 col's to the left

                  Esc, Return - terminates the function

                  All other keys are ignored unless they are specified
                  within cExitKeys parameter.  This list will tell the
                  routine what keys terminate the function.  Special
                  keys must be passed by a unique value and that value
                  can be found by looking in the keys.h file.

 Examples

     @ 4,9 TO 11,71

     FT_DFSETUP("test.txt", 5, 10, 10, 70, 1, 7, 15,;
                 "AaBb" + Chr(143), .T., 5, 132, 4096)

     cKey = FT_DISPFILE()

     FT_DFCLOSE()

     @ 20,0 SAY "Key that terminated FT_DISPFILE() was: " + '[' + cKey + ']'

 Source: DISPC.C

 Author: Mike Taylor

See Also: FT_DFSETUP() FT_DFCLOSE()