本文整理汇总了C++中Stream::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ Stream::Append方法的具体用法?C++ Stream::Append怎么用?C++ Stream::Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stream
的用法示例。
在下文中一共展示了Stream::Append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveModHdrsToStream
/////////////////////////////////////////////////////////////////
// SaveModHdrsToStream ()
// save module headers to stream w/o compressing the array
// first. Compression should be done outside this function
/////////////////////////////////////////////////////////////////
BOOL Ncb::SaveModHdrsToStream(PDB * pdb)
{
Stream * pstmMod;
Buffer buffer;
PB pBuffer;
// open stream for module hdrs
if (!pdb->OpenStream (SZ_NCB_MODULE_INFO, &pstmMod))
return FALSE;
if (!pstmMod->Truncate (0))
goto fail;
// save the array to the buffer
if (!m_rgModHdr.save (&buffer))
goto fail;
// find where the buffer starts
pBuffer = buffer.Start();
// start writing the buffer to the stream
if (!pstmMod->Append (pBuffer, buffer.Size()))
goto fail;
m_rgModHdr.setSize(0); // clean up arrays
m_rgStat.setSize(0);
m_rgNotifyBuild.setSize (0);
pstmMod->Release();
return TRUE;
fail:
pstmMod->Release();
return FALSE;
};
示例2: SaveReadModToStream
/////////////////////////////////////////////////////////////////
// SaveReadModToStream()
// given the module index (iBuf), we want to save it back to stream
// This is typically called after we LoadFrWriteToRead(), so we need
// to save its content to the stream.
/////////////////////////////////////////////////////////////////
BOOL Ncb::SaveReadModToStream (PDB * pdb, USHORT iBuf)
{
_ASSERT (iBuf < NCB_MOD_BUF_SIZE);
Stream * pstmMod;
char buf[512];
SZ szMod;
unsigned iHdr;
iHdr = m_rgContBuf[iBuf].m_iModHdr;
szMod = szFrNi (m_rgModHdr[iHdr].m_ni);
strcpy (buf, SZ_NCB_MODULE_PREFIX);
strcat (buf, szMod);
if (!pdb->OpenStream (buf, & pstmMod))
return FALSE;
if (!pstmMod->Truncate(0))
goto fail;
if (!pstmMod->Append (m_rgContBuf[iBuf].m_rgProp,
m_rgModHdr[iHdr].m_cProp * sizeof (NCB_PROP)))
goto fail;
if (!pstmMod->Append (m_rgContBuf[iBuf].m_rgUse,
m_rgModHdr[iHdr].m_cUse * sizeof (NCB_USE)))
goto fail;
if (!pstmMod->Append (m_rgContBuf[iBuf].m_rgParam,
m_rgModHdr[iHdr].m_cParam * sizeof (NI)))
goto fail;
// set buffer to be the oldest one:
pstmMod->Release();
m_rgContBuf[iBuf].m_prio = NCB_MOD_BUF_SIZE;
return TRUE;
fail:
pstmMod->Release();
return FALSE;
};
示例3: SaveTargetsToStream
////////////////////////////////////////////////////////////////
//
// SaveTargetsToStream(pdb)
// save target information to stream
/////////////////////////////////////////////////////////////////
BOOL Ncb::SaveTargetsToStream (PDB * pdb)
{
NCB_TARGET * rgTargets; // temporary array to store target info
Stream * pstmTarget;
char buf[512];
int i;
Array<NCB_MODINFO> rgModInfo;
USHORT cSize;
rgTargets = new NCB_TARGET[m_cTargets];
if (!rgTargets)
goto fail;
// for each target, save two arrays
// array of modules (m_rgModInfo)
for (i = 0 ; i < m_cTargets; i++)
{
Buffer buffer;
PB pBuffer;
SZ szTarget;
if (m_rgTargetInfo[i].m_ni == (NI)-1)
return FALSE;
szTarget = szFrNi (m_rgTargetInfo[i].m_ni);
strcpy (buf, SZ_NCB_TARGET_PREFIX);
strcat (buf, szTarget);
// REVIEW: should we compress it here or
// do this before compressing the modules
if (!CompressTarget (&m_rgTargetInfo[i], rgModInfo))
goto fail;
rgTargets[i].m_ni = m_rgTargetInfo[i].m_ni;
// store each target in a separate stream:
if (!pdb->OpenStream (buf, &pstmTarget))
goto fail;
if (!pstmTarget->Truncate(0))
goto fail;
cSize = 0;
// save the arrays in the buffer and write the content
// of the buffer to the stream
if (!rgModInfo.save (&buffer))
goto fail;
pBuffer = buffer.Start();
if (!pstmTarget->Append (pBuffer, buffer.Size()))
goto fail;
pstmTarget->Release();
pstmTarget = NULL;
}
if (!pdb->OpenStream (SZ_NCB_TARGET_INFO, &pstmTarget))
goto fail;
// store rgTargets
if (!pstmTarget->Truncate(0)) // delete previous information
goto fail;
if (!pstmTarget->Append (rgTargets, m_cTargets * sizeof (NCB_TARGET)))
goto fail;
pstmTarget->Release();
delete [] rgTargets;
return TRUE;
fail:
delete [] rgTargets;
pstmTarget->Release();
pstmTarget = NULL;
return FALSE;
};