描述:
//存入
IPersistStream* p; //已经获得
IStorage* pStgRoot;
IStorage* pSubStg;
IStream* pStream;
if(::StgCreateDocfile(L"MyStore.stg",STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_CREATE,0,&pStgRoot)==S_OK)
{
if(pStgRoot->CreateStorage(L"MySubName",STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_CREATE,0,0,&pSubStg)==S_OK)
{
if(pSubStg->CreateStream(L"MyStreamName",STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE,0,0,&pStream)==S_OK)
{
hr = p->Save(pStream,TRUE); //该步已经成功
}
pSubStg->Release();
}
pStgRoot->Release();
}
//如何读出呢?
解决方案1:
http://dev.csdn.net/develop/article/18/18465.shtm
解决方案2: IPersistStream::Load
MSDN文章Loading HTML content from a Stream
UP