Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.3 . Guide To CA-Clipper - <b>blobdirectimport()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 BLOBDIRECTIMPORT()
 Import a file into a BLOB file and return a pointer to the data
------------------------------------------------------------------------------
 Syntax

     BLOBDIRECTIMPORT(<nOldPointer>, <cSourceFile>)
         --> nNewPointer

 Arguments

     <nOldPointer> is a pointer to the BLOB data which will be released
     after the import.  This pointer can be obtained using BLOBDIRECTPUT(),
     BLOBDIRECTIMPORT(), or DBFIELDINFO(DBS_BLOB_POINTER, <nFieldPos>).
     Passing zero (0) disables the release of data.

     Important!  If specified, BLOBDIRECTIMPORT() releases the space
     associated with <nOldPointer> for reuse by other data.  Therefore, it is
     illegal to use <nOldPointer> with any of the BLOB functions after
     passing it as an argument to this function.  Use the function's return
     value to refer to the newly stored data.

     <cSourceFile> is the name of the file from which to read the BLOB
     data, including an optional drive, directory, and extension.  See
     SETDEFAULT() and SETPATH() for file searching and creation 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 another process has exclusive use of the file, for example,
     NETERR() is set to true (.T.).  Concurrency control:and
     BLOBDIRECTIMPORT()

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

 Returns

     BLOBDIRECTIMPORT() returns a numeric pointer to the BLOB image stored in
     <cSourceFile>.

 Description

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

     BLOBDIRECTIMPORT() is used in conjunction with BLOBDIRECTEXPORT() to
     transfer data back and forth between external files and BLOB files.  You
     can use BLOBDIRECTIMPORT() with a variety of file types, including
     graphic images, word processor files, and printer fonts.  These two
     functions are excellent for creating databases for documents, graphics,
     sounds, etc.

     Important!  After importing a file with BLOBDIRECTIMPORT(),
     nNewPointer, the return value, is the only way to access the data from
     the BLOB file.  It is up to you to provide permanent storage for this
     reference (see example below).

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

 Examples

     .  This example imports a bitmap (.bmp) file to be part of an
        array of startup data.  The data, stored in the root area of the BLOB
        file, could then be used to display the application's startup screen:

        FUNCTION PUTPIX()
           LOCAL cBMPFile
           LOCAL aSettings

           cBMPFile := "logo.bmp"
           aSettings := {}

           // Customer database where startup parameters
           // are stored for convenience
           USE Customer NEW VIA "DBFMEMO"

           // Get default path settings
           AADD(aSettings, STARTPATHS())

           // Get default color settings
           AADD(aSettings, DEFAULTCOLORS())

           // Get company logo for display at startup.
           // There is nothing to free because this
           // is the first time importing.
           nPointer := BLOBDIRECTIMPORT(0, cBMPFile)
           AADD(aSettings, nPointer)

           // Store the settings in the root area of
           // the customer.fpt file

           BLOBROOTPUT(aSettings)

 Files   Library is CLIPPER.LIB.


See Also: BLOBDIRECTEXP() BLOBIMPORT()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson