home *** CD-ROM | disk | FTP | other *** search
- /* The SETUP.C program must be compiled and run before this example */
- /* can be executed. */
-
- #include <stdio.h>
- #include "pxengine.h"
-
- #define TABLENAME "table"
-
- TABLEHANDLE tblHandle;
- RECORDHANDLE recHandle;
- BLOBHANDLE blbHandle;
- PXCODE pxErr;
-
- char buffer[256]; /* Buffer to read BLOB data into. */
- unsigned long read_size; /* Number of bytes to read from blob. */
-
- int main(void)
- {
- PXInit();
-
- /* Open a table that contains a BLOB field at field 4. */
-
- PXTblOpen(TABLENAME, &tblHandle, 0, 0);
- PXRecBufOpen(tblHandle, &recHandle);
- PXRecGet(tblHandle, recHandle);
-
- /* Open a BLOB for reading only. */
-
- PXBlobOpenRead(recHandle, 4, &blbHandle);
-
- PXBlobGetSize(blbHandle, &read_size);
-
- if (read_size > sizeof(buffer))
- read_size = sizeof(buffer);
-
- /* Read data into buffer from BLOB associated with field 4. */
-
- if((pxErr = PXBlobGet(blbHandle, (unsigned) read_size, 0, buffer))
- != PXSUCCESS)
- printf("%s\n", PXErrMsg(pxErr));
- PXBlobClose(blbHandle, PXBLOBACCEPT);
- PXRecBufClose(recHandle);
- PXTblClose(tblHandle);
- PXExit();
- return (pxErr);
- }
-