|
Boost Users : |
From: Alejandro Martinez (elpeque2_at_[hidden])
Date: 2008-07-30 11:43:52
great. that header is gone.
but i still have 2 bytes at the begginging with the value 0.
I detail what im serializing:
struct bichoStruct
{
int iuno;
int idos;
std::string name;
int itres;
std::vector<int> iarr;
template<class Archive>
void serialize(Archive & ar, const unsigned int)
{
ar & iuno & idos & name & itres & iarr;
}
bichoStruct(){};
};
bichoStruct a;
a.iuno = 1;
a.idos = 2;
a.name = "Recorcholis!";
a.itres = 3;
a.iarr.push_back(4);
a.iarr.push_back(5);
a.iarr.push_back(6);
and i get this:
00000000 00 00 01 00 00 00 02 00 00 00 0C 00 00 00 52 65
··?···?···?···Re
00000010 63 6F 72 63 68 6F 6C 69 73 21 03 00 00 00 03 00
corcholis!?···?·
00000020 00 00 04 00 00 00 05 00 00 00 06 00 00 00 ··?···?···?···
any ideas?
thanks a lot for your time :)
"Robert Ramey" <ramey_at_[hidden]> escribió en el mensaje
news:g6q0u2$5ua$1_at_ger.gmane.org...
>
>
> Alejandro Martinez wrote:
>>> What i need to do is this:
>>>
>>> Have a php file in a webserver, doing a POST with binary payload to a
>>> fast-cgi written in c++, and the c++ should deserialize that payload
>>> into a known struct.
>>>
>>> something like:
>>>
>>> struct whatever
>>> {
>>> int a;
>>> int b;
>>> float c;
>>> std::vector<int> d;
>>> }
>>>
>>> (mainly structs consisting of basic types and collections of basic
>>> types)
>
> Generally I would not recommend trying to read/process/creat archives
> in language other that C++ with boost serialization. It is doable and
> people have done it, but it breaks one of the most valuable features
> of boost serialization - no brainer archive format maintainence.
>
>>> I've been playing around with boost::serialization, but i can't seem
>>> to comprehend the binary format it generates (So i could hardcode
>>> the php to make a valid payload to be deserialised from the
>>> fast-cgi).
>
>
> The easiest way to understand the format of the file
> is to write to an xml_archive. This will contain all
> the same data in a more readible way.
>
>>> And not so important: i've noticed boost::serialization to binary
>>> archives always look like:
>>>
>>> serialization::archive ÃõH@
>>>
>
>
> the "serialization::archive" is an identifier which
> the de-serialization uses to gracefully handle the
> situation where one hands it a file not created by
> serialization. To suppress it, use "no_header" flag
> when opening archives.
>>> can't i get rid of the "serialization::archive" thing that is
>>> obviusly not part of the struct i just serialized?
>
>
>
>
>
--------------------------------------------------------------------------------
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net