12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include <stdio.h>
- int main(int argc, char *argv[])
- {
- printf("Hello, world\n");
-
- return 0;
- }
- typedef struct tagresdata2
- {
- BOOL bHasBk; //
- int nPicCount; //
- int nPicCount2; //
- DWORD nPicBmpCount[50]; // 为何设置魔数50?
- CRect rect[50]; // 为何设置魔数50?
- }RESDATA2;
- BYTE *pData = NULL;
- DWORD dwCount = 0;
- CStringArray AryRect;
- // 1.头部,获取图元个数;
- memcpy(&dwCount, pData, sizeof(DWORD));
- // 2.移动sizeof(DWORD)个字节,获取图元实际数据;
- pData += sizeof(DWORD);
- BYTE *pRealData = new BYTE[dwCount];
- memcpy(pRealData, pData, dwCount);
- // 将数据载入AryRect中;
- CMemFile memfile;
- memfile.Attach(pRealData, dwCount);
- CArchive ar(&memfile, CArchive::load);
- AryRect.Serialze(ar);
- ar.Close();
- memfile.Detach();
- if ( pRealData )
- {
- delete []pRealData;
- }
- // 3.移动dwCount个字节;
- RESDATA2 tagResData;
- pData += dwCount;
- memcpy(&tagResData, pData, sizeof(RESDATA2));
- // 4.移到sizeof(RESDATA2)个字节;
- pData += sizeof(RESDATA2);
- if ( tagResData.bHasBk )
- {// bHasBk一般都为false;
- DWORD dwleng = 0;
- BYTE *pSaveBk = NULL;
- }
|