Insert the contents of a file into a field

     DBFILEPUT(<nFieldPos>, <cSourceFile>)
        --> lSuccess


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

     <cSourceFile> is the name of the file containing the data to insert
     into the specified field, including an optional drive, directory and
     extension.  See SetDefault() and SetPath() for file searching rules. No
     default extension is assumed.

     This function attempts to open <cSourceFile> in shared mode. If the file
     does not exist, a runtime error is raised.  If the file is successfully
     opened, the operation proceeds.  If access is denied because, for
     example, another process has exclusive use of the file, NetErr() is set
     to true (.T.).

     Note:  There are no restrictions on the size of <cSourceFile> except
     that you must have enough disk space to make the copy.


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


     DBFILEPUT() provides a mechanism for copying the contents of a file into
     a field.  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.

     DBFILEPUT() is used in conjunction with DBFILEGET() to transfer data
     back and forth between files and database fields.  You can use
     DBFILEPUT() with a variety of field types, including graphics images,
     word processor files, and printer fonts.  These two functions are
     excellent for creating databases of documents, graphics, sounds, etc.

     Note: DBFieldInfo ( DBS_BLOB_TYPE, <nFieldPos> ) will return "C"
     (string) for any memo field created using DBFILEPUT().


     .  This example imports information from a word processing
        document into a field, then uses BLOBGet() to extract the first 25
        characters of the field:

        FUNCTION Populate()
           USE customer NEW VIA "DBFCDX"
           DO WHILE .NOT. EOF()
              GetPix( "Pix", Substr(LastName, 1, 4) + CustID)

        FUNCTION GetPix(cPixField, cPixFile)
           LOCAL nPos
           nPos := FieldPos(cPixField)

           // Import the picture field into the indicated field
           IF ! DBFILEPUT(nPos, cPixFile)
              Alert("Import of picture " + cPixFile + ;
                    " failed!")

 Files   Library is CLIPPER.LIB


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.