请教各位高手: 我想把硬盘上的.gif图片保存到数据字典,然后可以从数据字典中读取数据再还原到硬盘上. 可是.gif如何保存到数据字典?我是用下面的格式保存字符串等信息的,但不知道图片怎么保存, 发现有一个 AcDb::kDxfBinaryChunk类型,字面上是二进制块,不知道是保存什么类型的 AcDbDictionary *pNamedobj, *pDict; acdbHostApplicationServices()->workingDatabase() ->getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite); if (pNamedobj->getAt("ASDK_DICT", (AcDbObject*&) pDict, AcDb::kForWrite) == Acad::eKeyNotFound) { pDict = new AcDbDictionary; AcDbObjectId DictId; pNamedobj->setAt("ASDK_DICT", pDict, DictId); } pNamedobj->close(); // Add a new xrecord to the ASDK_DICT dictionary. // AcDbXrecord *pXrec = new AcDbXrecord; AcDbObjectId xrecObjId; pDict->setAt("XREC1", pXrec, xrecObjId); pDict->close(); struct resbuf *pHead; DWORD flen; CFile bfile; CMemFile buffer; BYTE *psf; bfile.Open("c:\\abc.gif",CFile::modeReadWrite,NULL); flen=bfile.GetLength(); psf=(BYTE*)new char[flen]; bfile.Read(psf,flen); bfile.Close(); pHead = acutBuildList( AcDb::kDxfText,"1", //AcDb::kDxfBinaryChunk, //*psf, AcDb::kDxfInt16, *psf, AcDb::kDxfText, "This is a test Xrecord list", AcDb::kDxfText, "DocumentId", 0); pXrec->setFromRbChain(*pHead); acutRelRb(pHead); pXrec->close();
|