SaveArray example for C++ 5.0 and later

long lSize;
   HFILE hFile; 
   void HUGEP* pData=NULL; 
   ILEADRasterIO *pRasterIO=NULL; 
   ILEADRasterVariant * pltRasVar = NULL; 

   CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL, 
                                   IID_ILEADRasterVariant, (void **)&pltRasVar); 
   CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, 
                    IID_ILEADRasterIO, (void**)&pRasterIO); 

   pRasterIO->Load(m_LEADRasterView1.GetRaster(),
                   "v:\\images\\chess.bmp", 0, 1, 1); 
   
   pltRasVar = pRasterIO->SaveArray(m_LEADRasterView1.GetRaster(),
                                FILE_BMP, 0, (QFactorConstants)0); 
   _tcreat(TEXT("c:\\temp\\test.bmp"), 0); 
   hFile = _tfopen(TEXT("c:\\temp\\test.bmp"), OF_READWRITE); 

   lSize = pltRasVar->ItemCount
   pData = GlobalAlloc(GHND,lSize);   
   _lwrite(hFile, (LPCSTR)pData, lSize);   
   _lclose(hFile); 

   //get some info on the memory array
   pRasterIO->GetArrayInfo(m_LEADRasterView1.GetRaster(), pltRasVar, 1, lSize); 
   CString cs; 
   cs.Format(TEXT("Format = %d"), pRasterIO->GetInfoFormat());
   AfxMessageBox(cs); 
   pRasterIO->Release();
   pltRasVar->Release ();
   GlobalFree(pData);