BLOBExport Function | |
Copy the contents of a BLOB, identified by its memo field number, to a file.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION BLOBExport(
nFieldPos,
cTargetFile,
kMode
) AS LOGIC CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static bool BLOBExport(
Usual nFieldPos = default,
Usual cTargetFile = default,
Usual kMode = default
)
Request Example
View SourceParameters
- nFieldPos (Optional)
- Type: Usual
The position of the field in the database file structure. - cTargetFile (Optional)
- Type: Usual
The name of the target file where the BLOB 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 process is using the file, NetErr() is set to TRUE.
- kMode (Optional)
- Type: Usual
A constant defining the copy mode, as shown in the table below:
ConstantDescriptionBLOB_EXPORT_APPENDAppends to the fileBLOB_EXPORT_OVERWRITEOverwrites the file — this is the default
Return Value
Type:
Logic
TRUE if successful; otherwise, FALSE.
Remarks
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
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:
1FUNCTION ShowPix()
2 LOCAL cPixFile := "picture.gif" AS STRING
3 LOCAL nPos
4
5
6 USE customer NEW VIA "DBFCDX"
7 nPos := FIELDPOS("Pix")
8
9
10 IF !BLOBExport(nPos, cPixFile,;
11 BLOB_EXPORT_OVERWRITE)
12 Alert("Export of picture " + cPixFile + ";
13 failed!")
14 ELSE
15
16 ENDIF
See Also