
1 Sep
2008
1 Sep
'08
4 p.m.
This example should probably be ar << binary_object(i + 1, p); // etc Robert Ramey Basilevs wrote:
On Sat, Aug 30, 2008 at 11:12 AM, Robert Ramey
wrote: I'm suspecting that there is a confusion about how to seriailzation a pointer to a null terminated string. It's natural to want to do something like
char *p; ... p = "jsdkfjads" ... ar & p;
because the library syntax encourages one to think that way.
But in this case, one would want
save(... int i = strlen(p); ar << i; ar << binary_object(i, p); }
load(... int i; ar >> i; ar >> binary_object(i,p); }
How do we deal with the trailing null? In this example trailing null is not saved, and it is a good thing, but shouldn't we add it after loading?