I have an attachment PDF with pixel alignment.

Then I have this code which assigns short integer to appropriate pixels.

void CMFC3xxDevice::prepare_data_decompress(data_package_ex &pdata)

		char *input = (char*) pdata.pData;
		int incount=pdata.cbData;
		int finalarray_pos = 0;
		DWORD dwTempBufferSize = pdata.cbData;
		for(int i = 0; i < incount; i+=3)
			MFC3XXPixelAlignment *pSourcePixel = reinterpret_cast<MFC3XXPixelAlignment*>((char *)input+i);	    		
			//pSourcePixel->bytes[0] = (final_array[finalarray_pos]& 0xff;
			//pSourcePixel->bytes[1] = (final_array[finalarray_pos] & 0xf0)+(final_array[finalarray_pos+1]& 0xf00);
			//pSourcePixel->bytes[2] = (final_array[finalarray_pos+1] & 0xff0);
			pSourcePixel->bytes[0] = final_array[finalarray_pos]& 0xff;
			pSourcePixel->bytes[1] = ((final_array[finalarray_pos] & 0xf00)<<4)+(final_array[finalarray_pos+1]& 0xf);
			pSourcePixel->bytes[2] = (final_array[finalarray_pos+1] & 0xff0)<<4;



I am having memory violation when debugging the code.

Any ideas:

Thank you.

I wanted to know if the pixel assignments are correct?

So run it in the debugger, and find the line of code which actually triggers the memory fault.

Don't just post a few lines of code for your "best guess" and ask "what does this look like?"