
1 Sep
2008
1 Sep
'08
3:12 a.m.
On Sat, Aug 30, 2008 at 11:12 AM, Robert Ramey
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?