Insert the contents of a field into a file

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


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

     <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

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


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


     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.


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

        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!")

              // Code for displaying picture would go here

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


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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.