The following code reads a LOB from the input stream and copies its content into the output stream.
LOB_RESULT_LOCATOR lrl_a; int streamno=0; int i; BYTE *locator; int locatorLength; int null_ind; FNC_LobLength_t lobLength; LOB_CONTEXT_ID lobid; BYTE Buffer[BufferSize]; int length; int truncerr; FNC_TblOpHandle_t *Handle, *OutHandle; ....... // Get locator for LOB in column i of output stream streamno lrl_a = FNC_LobCol2Loc(streamno, i); // Get client locator for input LOB FNC_TblOpGetAttributeByNdx(Handle, i, (void **) &locator, &null_ind, &locatorLength); if (null_ind != -1) { // Open input LOB FNC_LobOpen_CL(locator, &lobid, 0, 0); truncerr = 0; // Read input LOB and append it to output LOB while( FNC_LobRead(lobid, Buffer, BufferSize, &length) == 0 && !truncerr) truncerr=FNC_LobAppend (lrl_a, Buffer, length, &actlen); // Close input LOB FNC_LobClose(lobid); } else // Set output column to NULL FNC_TblOpBindAttributeByNdx(OutHandle, i, locator, null_ind, locatorLength);