another example:
#include "client.h"
#include "proto/uMemcached.pb.h"
int main() {
//Client client("127.0.0.1", 27777);
//client.run();
mcmessage::Query query;
query.set_type(mcmessage::Query::SET);
query.set_key("good");
query.set_value("bad");
std::string str;
char buf[1024] = {0};
query.SerializeToString(&str);
query.SerializeToArray(buf, query.ByteSize());
std::cout << "str: " << str << std::endl;
std::cout << "buf: " << buf << std::endl;
}
run it, get:
> str:goodâ–’bad
> buf:
>
the buf is not filled.
why.....
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.