Boost logo

Boost :

From: X Wang (wangx0802_at_[hidden])
Date: 2008-01-29 17:19:01


What I want is to concatenate some of my own data (all printable strings, delimited by some char, say 0x01) and append serialized data (from different modules, treated as a black box) to it. For this reason, I need a delimiter(hopefully from ascii set) which is not in serialized charater set so I could figure out the boundary and decode the whole string later. What you suggested would work, just the setup becomes less straightforward for my case.
   
  Thx.

Robert Ramey <ramey_at_[hidden]> wrote:
  Since a std:string and std:wstring could contain any character, there is no
way go guarentee that any specific character would not be used.

I'm not sure why you want to do this.

maybe you would like to use a string stream and serialize the data into
that. The you could use a string stream to load it and you would already
have what you wanted.

{
fstream os;
text_oarchive oa(os);
oa<< my_complicated_class_instance;
oa << another_complicated_class_instance;
}
{
stringstream is
text_iarchive ia(is);
ia >> my_complicated_class_instance;
std::string first;
first = is.?string;
is.string.clear();
ia >> another_complicated_class_instance
std::sting second;
second = is.?string
}

Robert Ramey

X Wang wrote:
> Hi, I am using boost serialization text_oarchive to serialize data
> objects into text strings, and then I need to delimit several of
> these serialized strings and concatenate them into an ascii text. So
> obvious I want to choose a delimiter (currently using 0x01) not used
> by boost serialization. My question is how do I find the character
> set used by boost serialization so that whatever I choose for my
> delimiter would not shows up in text_oarchive's result?
>
> Thx.
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
> Try it now. _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

       
---------------------------------
Never miss a thing. Make Yahoo your homepage.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk