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 MyGetFileDataFu nction(
prHandle CameraHandle,
prObjectHandle ObjectHandle,
prContext Context,
prProgress* pProgress
)
{
static ofstream out("capture.jp g", ios::out|ios::b inary);
switch( pProgress->lMessage )
{
prUInt8 imgbuffer[1024];
case prMSG_DATA_HEAD ER:
break;
case prMSG_DATA:
for (prUInt32 index = 0; index < pProgress->lLength; index++)
{
imgbuffer[index] = pProgress->pbData[index];
}
PowershotDll::P owershotSdkDll: :Copy(imgbuffer ,pProgress->lLength); //Calling another function and send the data
memcpy(CaptureI mage,imgbuffer, 1024L);
out.write((cons t char*)CaptureIm age,1024L);
break;
case prMSG_TERMINATI ON:
out.close();
break;
}
return prOK;
}
Copy function:
void PowershotSdkDll ::Copy(prUInt8 *pDataBuffer, prUInt32 dataLength)
{
// Byte managedDataBuff er __gc[] = new System::Byte[dataLength];
BYTE managedDataBuff er[1024];
for (prUInt32 index = 0; index < dataLength; index++)
{
managedDataBuff er[index] = pDataBuffer[index];
}
/// Write the data to the memoryStream
//pMemoryStream->Write(managedD ataBuffer, 0, dataLength);
static ofstream out1("Copycaptu re.jpg", ios::out|ios::b inary|ios::app) ;
out1.write((con st char*)managedDa taBuffer, 1024L);
out1.close();
}
I got the image capture.jpg but i didnt get the copycapture.jpg image which contain only 1024 bytes.
How to re-assign the array for every data?
Pleae give your suggestion.
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 MyGetFileDataFu nction(
prHandle CameraHandle,
prObjectHandle ObjectHandle,
prContext Context,
prProgress* pProgress
)
{
static ofstream out("capture.jp g", ios::out|ios::b inary);
switch( pProgress->lMessage )
{
prUInt8 imgbuffer[1024];
case prMSG_DATA_HEAD ER:
break;
case prMSG_DATA:
for (prUInt32 index = 0; index < pProgress->lLength; index++)
{
imgbuffer[index] = pProgress->pbData[index];
}
PowershotDll::P owershotSdkDll: :Copy(imgbuffer ,pProgress->lLength); //Calling another function and send the data
memcpy(CaptureI mage,imgbuffer, 1024L);
out.write((cons t char*)CaptureIm age,1024L);
break;
case prMSG_TERMINATI ON:
out.close();
break;
}
return prOK;
}
Copy function:
void PowershotSdkDll ::Copy(prUInt8 *pDataBuffer, prUInt32 dataLength)
{
// Byte managedDataBuff er __gc[] = new System::Byte[dataLength];
BYTE managedDataBuff er[1024];
for (prUInt32 index = 0; index < dataLength; index++)
{
managedDataBuff er[index] = pDataBuffer[index];
}
/// Write the data to the memoryStream
//pMemoryStream->Write(managedD ataBuffer, 0, dataLength);
static ofstream out1("Copycaptu re.jpg", ios::out|ios::b inary|ios::app) ;
out1.write((con st char*)managedDa taBuffer, 1024L);
out1.close();
}
I got the image capture.jpg but i didnt get the copycapture.jpg image which contain only 1024 bytes.
How to re-assign the array for every data?
Pleae give your suggestion.
Comment