Hi all,

I want to create a buffer to send to some external device. I store the values in char arrays.

I want to copy the values into one buffer with this code:

Code:
void CRobotData::GenerateBuffer(char * pBuffer)
{
	// Declare variables
	int iPointerAddress = 0;

	// Copy all data
	memcpy(pBuffer + iPointerAddress, m_a, 4);
	iPointerAddress += 4;
	memcpy(pBuffer + iPointerAddress, m_b, 4);
	iPointerAddress += 4;
	memcpy(pBuffer + iPointerAddress, m_c, 4);
	iPointerAddress += 4;
	memcpy(pBuffer + iPointerAddress, m_d, 4);
}
The buffer is created like this:
Code:
char * pBuffer = new char[16];
ZeroMemory(pBuffer, 16);
What happens is this:
pBuffer = "0000000000000000ýýýýÝÝÝÝA"

It is driving me crazy, why isn't the buffer 16 x 0 as it should be?

Thanks!