예제 #1
0
int BufSize(EventLog& TheLog)
{
       int nBufSize = sizeof(int);
       EventLog::iterator i;

       for (i = TheLog.begin(); i != TheLog.end(); i++)
       {
               nBufSize += (*i).strGUID.size() + sizeof(char);
               nBufSize += sizeof(int) + sizeof(long);
       }
       return nBufSize;
}
예제 #2
0
void ToBuffer(EventLog& TheLog, char* pBuffer, int& nBuffUsed)
{
       int nNumEntries = TheLog.size();
       int nOffset = sizeof(int);
       memcpy(pBuffer, &nNumEntries, sizeof(int));
       EventLog::iterator i;
       int nTemp = 0;

       for (i = TheLog.begin(); i != TheLog.end(); i++)
       {
               nTemp = (*i).strGUID.size();
               memcpy(&pBuffer[nOffset], (*i).strGUID.c_str(), nTemp);
               nOffset += nTemp;
               pBuffer[nOffset] = '\0';
               nOffset += sizeof(char);
               memcpy(&pBuffer[nOffset], &((*i).nEventType), sizeof(int));
               nOffset += sizeof(int);
               memcpy(&pBuffer[nOffset], &((*i).lTimeStamp), sizeof(long));
               nOffset += sizeof(long);
       }
       
       nBuffUsed = nOffset;
}