-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMsg.cpp
More file actions
44 lines (36 loc) · 949 Bytes
/
Msg.cpp
File metadata and controls
44 lines (36 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Msg.cpp: implementation of the CMsg class.
//
//////////////////////////////////////////////////////////////////////
#include "Msg.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMsg::CMsg()
{
m_pData = NULL;
m_dwSize = NULL;
}
CMsg::~CMsg()
{
if (m_pData != NULL) delete m_pData;
}
BOOL CMsg::bPut(char cFrom, char * pData, DWORD dwSize, int iIndex, char cKey)
{
m_pData = new char [dwSize + 1];
if (m_pData == NULL) return FALSE;
ZeroMemory(m_pData, dwSize + 1);
memcpy(m_pData, pData, dwSize);
m_dwSize = dwSize;
m_cFrom = cFrom;
m_iIndex = iIndex;
m_cKey = cKey;
return TRUE;
}
void CMsg::Get(char * pFrom, char * pData, DWORD * pSize, int * pIndex, char * pKey)
{
*pFrom = m_cFrom;
memcpy(pData, m_pData, m_dwSize);
*pSize = m_dwSize;
*pIndex = m_iIndex;
*pKey = m_cKey;
}