In summary I am trying to pass a compressed file to an uncompress function...
The uncompress function is defined as follows
I then have an open file dialog....Code:/*------------------------------------------------------------------------------ -------------------------- int DecompressLZW(BYTE *pSrcData,DWORD dwSrcSize,BYTE* OutputBuffer,DWORD dwMaxOutput) pSrcData - raw compressed data to be decompressed dwSrcSize - the number of bytes of compressed data to decompress OutputBuffer - the location to write the decompressed data into dwMaxOutput - the maximum amount to write into the OutputBuffer -------------------------------------------------------------------------------- ---------------------*/
The problem is the file.read requires a char * buffer and if I use a char * buffer I cannot pass pSrcData to the function as the function requires a Byte *Code:BYTE * OutputBuffer; BYTE * pSrcData; CString strl="Please Select a Compressed File to Decompress"; char strFilter8[]= { "CMP Files(*.cmp)|*.cmp|All Files(*.*)|*.*||"}; CFileDialog dlgFile8(TRUE, ".cmp", NULL,0,strFilter8); dlgFile8.m_ofn.lpstrTitle= strl; if (dlgFile8.DoModal() ==IDOK) { ifstream file9((LPCTSTR) dlgFile8.GetFileName(), ios::in|ios::binary); file9.seekg (0, ios::end); int sizecmp = file9.tellg(); int sizecmp2 = sizecmp * 3; file9.seekg (0, ios::beg); pSrcData = new BYTE[sizecmp]; file9.read (pSrcData, sizecmp); file9.close(); OutputBuffer = new BYTE[sizecmp2]; DecompressLZW(pSrcData,sizecmp, OutputBuffer,sizecmp2); }
I know the answer is staring me in the face but I cant seem to get it to work.




Reply With Quote