summaryrefslogtreecommitdiff
path: root/src/proto/write.cc
blob: 2e206e5ad519e2e40c6fba1a63ccd9f7dc508295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}