| 42 | } |
| 43 | |
| 44 | void WriteProtoToTextFile(const Message& proto, const char* filename) { |
| 45 | int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
| 46 | FileOutputStream* output = new FileOutputStream(fd); |
| 47 | CHECK(google::protobuf::TextFormat::Print(proto, output)); |
| 48 | delete output; |
| 49 | close(fd); |
| 50 | } |
| 51 | |
| 52 | bool ReadProtoFromBinaryFile(const char* filename, Message* proto) { |
| 53 | int fd = open(filename, O_RDONLY); |
no outgoing calls