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

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

 Arguments

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

     <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.

 Returns

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

 Description

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

 Examples

     .  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)
              Customer->DBSkip()
           ENDDO

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

 Files   Library is CLIPPER.LIB


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