Re: serialization, size errors... or something else.

  • From: "qubit" <lauraeaves@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 30 Jun 2010 17:13:56 -0500

Ok, the plot thickens -- did you cast the address of the pointer to a char* 
to pass to fwrite? Maybe a dumb question but I'm just feeling this out.
You have p being of some type T* and you say
    fwrite(fp, (char*)p, sizeof(T));
Is this done in a template function where you don't know the final type of 
T?
What is T anyway?
I'm just hoping some funny pointer arithmetic is not getting done on p 
because you are passing it around as different types.
Any progress?
--le


----- Original Message ----- 
From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, June 30, 2010 4:55 PM
Subject: Re: serialization, size errors... or something else.


Basically what I did was used a templated function to write, then I write 
the arg with fwrite, and use sizeof(T) to get the size. Reading does the 
same thing, I also overloaded operators << and >> to read and write.
Thanks,
Tyler Littlefield
http://tds-solutions.net
Twitter: sorressean

On Jun 30, 2010, at 3:53 PM, qubit wrote:

> without knowing a little about your serialization strategy, it's hard to
> diagnose what might be wrong.
> Do you do something similar to Boost, or do you have some other algorithm?
> --le
>
> ----- Original Message ----- 
> From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Wednesday, June 30, 2010 4:02 PM
> Subject: Re: serialization, size errors... or something else.
>
>
> I do know I'm reading to much because I get a size excception. I'm not 
> sure
> how to cut this down because the serialization works through an 
> inheritance
> hierarchy.__________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: