Hello Guys
How Can I read data from memory buffer ??
Example
unsigned char* totalResponse = NULL;
unsigned long totalResponseSize = 0;
const unsigned long RECVRESPONSE_TEMPBUFFERSIZE = 10 * 1024;
unsigned long readBufferSize = RECVRESPONSE_TEMPBUFFERSIZE;
// Temporary buffer that stores response comes from the printer
unsigned char readBuffer[RECVRESPONSE_TEMPBUFFERSIZE] = { 0 };
do {
// sleep to get the printer ready to respond
// Receive reponse from the printer
readBufferSize = RECVRESPONSE_TEMPBUFFERSIZE;
readResult = pu3Read(hSDK, readBuffer, &readBufferSize, &needContinue);
l = readResult;
if (CNMPU3_ERR_SUCCESS == readResult) {
unsigned char* tmp = NULL;
tmp = totalResponse;
totalResponse = (unsigned char*)malloc(sizeof(char) * (readBufferSize + totalResponseSize));
if (NULL == totalResponse)
break;
if (NULL != tmp)
{
memcpy_s(totalResponse, readBufferSize + totalResponseSize, tmp, totalResponseSize);
free(tmp);
}
// Store
memcpy_s(totalResponse + totalResponseSize, readBufferSize, readBuffer, readBufferSize);
totalResponseSize += readBufferSize;
}
else if (CNMPU3_ERR_NOCONTENT == readResult) {
Sleep(1000); // sleep to get the printer ready to respond
continue;
}
else {
break;
}
} while (needContinue == CNMPU3_TRUE);
so How to get a value from *totalresponse ??
Pls Sugest me
Thanks for Help !!!