|
-
June 5th, 1999, 05:07 PM
#1
Using serialization for making packets of byte arrays
I'm trying to make packets that will each contain a 3D byte array. Currently I have something like the following. Please help!
#include "stdafx.h"
#include "Twixt.h"
#include "Packet.h"
IMPLEMENT_SERIAL(CPacket,CObject,1)
//#include <string.h>
//#include <stdio.h>
//char stringy[80];
//strcat(stringy, "hello" );
void CPacket::Serialize(CArchive &ar)
{
if (ar.IsLoading()) {
ar>>cmd>>x>>y;
// ar.WriteObject((CObject *)data);
ar.WriteObject((CByteArray *)data);
}
else {
ar<<cmd<<x<<y;
ar.ReadObject((CByteArray *)data);
//data=ar.ReadObject((IsKindOf(*data))data);
}
}
-
June 6th, 1999, 09:36 PM
#2
Re: Using serialization for making packets of byte arrays
If you are trying to serailize a CByteArray ptr created using the new operator just use
ar << data;
else
ar >> data;
if the CByteArray is a memeber variable
use
data.Serialize(ar); for both the save and load
HTH,
Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|