Hi,
Of course you can serialize and deserialize a char*, but you have to know your array size. Assuming you char* is named m_str, its length is named m_lg, and that your header contains only this pointer, the following code will serialize and deserialize it:
void
YourHeader::Serialize (Buffer::Iterator start) const
{
Buffer::Iterator it = start;
for (uint i=0;i<m_lg;i++)
{
it.WriteU8 (m_str[i]);
}
}
uint32_t
YourHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator it = start;
if (m_str) delete m_str;
m_str = new char[m_lg];
for (uint i=0;i<m_lg;i++)
{
m_str[i] = it.ReadU8 ();
}
return GetSerializedSize ();
}
Regards,
Guillaume