summaryrefslogtreecommitdiff
path: root/src/proto/write.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/proto/write.cc')
-rw-r--r--src/proto/write.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/proto/write.cc b/src/proto/write.cc
new file mode 100644
index 0000000..2e206e5
--- /dev/null
+++ b/src/proto/write.cc
@@ -0,0 +1,17 @@
+#include <fstream>
+#include <string>
+
+#include "example.pb.h"
+
+int main(int argc, char **argv) {
+ sample::Example example;
+ example.set_foo(std::string{argv[1]});
+ example.set_bar(atoi(argv[2]));
+ {
+ std::fstream output(argv[3],
+ std::ios::out | std::ios::trunc | std::ios::binary);
+ example.SerializeToOstream(&output);
+ }
+
+ return 0;
+}