I need help about serialization.

That matter is that I have KcFile Class below.
class KcFile
{
private:
char * m_pbuff;

public :
void WriteInt(&p_buff);
void WriteFloat(&p_buff);
int ReadInt();
int ReadFloat();
};

WriteInt and WriteFloat get Int or float that will be into m_pbuff var.

For instance, when i input 1, the buffer will be
1(4bytes) cccccccccc ...
then i input 20.5f, buffer will be
1(4bytee) 20.5f(4bytes) cccccccc ..
And then i will read the buffer from first address when i finish input datas.
I call ReadInt and ReadFloat, the result will be 1 20.5f.

I hope that you understand what i mean.

please help me T_T. I 've wasted 7 hours of it.

Thanks. have a good day.
Can you post the code for the functions. In the prototypes for WriteInt and WriteFloat you look like your trying to declare the parameters as references but to what type???
I forgot to write the type in write Fucntions.
actual function was void WriteInt(int &p_int) and WriteFloat (float &p_float);
I believe that you understand. :)
Also this class is for understaing how File I/O works.
Topic archived. No new replies allowed.