Hi I have a bit of issue for serializing in C and deserializing it in python,
I defined a message to carry data, serialize it into array in C, then send it over to python (via ctype). I noticed that since the serialized array may contains 0 (zero) values, It is better of to send as array of int to python, otherwise truncated message would be transferred ( python expects strings are NULL terminated ). In this case when I receive an array of int values in python, I don't know how to reconstruct a string from those values and feed it to ParseFromString() because ParseFromString() does not accept array_of_int, because it does not have len(). I can not build a string in python especially some of the values are negative and python does not let me convert negative value to char. Any comment ? Codes: message siftOut{ message keypoint { required float x = 1; repeated float descr= 2 [packed=true]; } repeated keypoint keypoints= 1; } ; When I filled a message such as: siftOut vFrmDescr; siftOut_keypoint *frmDescr = vFrmDescr.add_keypoints(); int l ; frmDescr->set_x ( (float) k -> x ); for (l = 0 ; l < 128 ; ++l) { frmDescr->add_descr ( (512.0 * descr [l]) ) ; } Then char * charOut = new char[vFrmDescr.ByteSize()]; vFrmDescr.SerializeToArray( charOut , vFrmDescr.ByteSize()); and send it to python in python LIB = cdll[_loc] LIB.protoBufFunc.argtypes =[c_char_p , c_int32 ] LIB.protoBufFunc.restype = POINTER(c_int32) stDescriptors = LIB.protoBufFunc( " A sample dataa in string format " , 50 ); Now how can I use parsefromString() in python to read stDescriptors ? Appreciate your help in advance. Regards Mani -- 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 protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.