Hi,
I am retrieving the image from DLL through vc++ dll. Actually Image is retrieving in Callback function of main function. When I writing that image file inside of the Callback function then no problem in retrieving. At the same I want to send the Imagedata to the another function and write the same which cause the error.
Here I given that code,
//Callback function
prResponse prSTDCALL MyGetFileDataFunction(
prHandle CameraHandle,
prObjectHandle ObjectHandle,
prContext Context,
prProgress* pProgress
)
{
static ofstream out("capture.jpg", ios:
{
prUInt8 imgbuffer[1024];
case prMSG_DATA_HEADER: break; case prMSG_DATA: for (prUInt32 index = 0; index < pProgress->lLength; index++){
imgbuffer[index] = pProgress->pbData[index];
}
PowershotDll:owershotSdkDll::Copy(imgbuffer,pProgress->lLength); //Calling another function and send the data
memcpy(CaptureImage,imgbuffer,1024L);
out.write((
const char*)CaptureImage,1024L); break; case prMSG_TERMINATION:out.close();
break;}
return prOK;
}
Copy function:
void
PowershotSdkDll::Copy(prUInt8 *pDataBuffer, prUInt32 dataLength){
// Byte managedDataBuffer __gc[] = new System::Byte[dataLength];BYTE managedDataBuffer[1024];
for (prUInt32 index = 0; index < dataLength; index++){
managedDataBuffer[index] = pDataBuffer[index];
}
/// Write the data to the memoryStream //pMemoryStream->Write(managedDataBuffer, 0, dataLength); static ofstream out1("Copycapture.jpg", ios:
out1.write((
const char*)managedDataBuffer, 1024L);out1.close();
}
I got the image capture.jpg but i didnt get the copycapture.jpg image which contain only 1024 bytes.
Pleae give your suggestion.