[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DBFILEGET()
 Insert the contents of a field into a file
------------------------------------------------------------------------------
 Syntax

     DBFILEGET(<nFieldPos>, <cTargetFile>, <nMode>)
        --> lSuccess

 Arguments

     <nFieldPos> is the position of the field in the database file
     structure.

     <cTargetFile> is the name of the file where the field data will be
     written, including an optional drive, directory and extension. See
     SetDefault() and SetPath() for file searching and creation rules. No
     default extension is assumed.

     If <cTargetFile> does not exist, it is created. If it exists, this
     function attempts to open the file in exclusive mode and if successful,
     the file is written to without warning or error. If access is denied
     because, for example, another proess is using the file, NetErr() is set
     to TRUE.

     <nMode> is a constant defining the copy mode, as shown in the table
     below:

     DBFILEGET() Constants
     ------------------------------------------------------------------------
     Constant            Description
     ------------------------------------------------------------------------
     FILEGET_APPEND      Appends to the file.
     FILEGET_OVERWRITE   Overwrites the file.  This is the default.
     ------------------------------------------------------------------------

 Returns

     DBFILEGET() returns true (.T.) if successful; otherwise it returns false
     (.F.).

 Description

     DBFILEGET() provides a mechanism for copying the contents of a field
     into a file.  By default, this function operates on the currently
     selected work area.  It can be made to operate on an unselected work
     area by specifying it within an aliased expression.

     DBFILEGET() is used in conjunction with DBFILEPUT() to transfer data
     back and forth between files and database fields.

 Examples

     .  This example exports the contents of a field that stores a
        picture to a .GIF file, so that the file can be programmatically
        displayed:

        FUNCTION ShowPix()
           LOCAL cPixFile := "picture.gif"
           LOCAL nPos

           // Customer database with a picture of each
           // customer stored in a field called "Pix"
           USE customer NEW VIA "DBFCDX"
           nPos := FieldPos("Pix")

           // Export the file's data for the current Pix field
           IF ! DBFILEGET(nPos, cPixFile, FILEGET_OVERWRITE )
              Alert("Export of picture " + cPixFile +
              " failed!")

           ELSE
              // Code for displaying picture would go here
           ENDIF

 Files   Library is CLIPPER.LIB, header is Dbinfo.ch


See Also: DBFILEPUT()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson