diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-05-31 18:30:10 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-06-03 10:09:24 +0200 |
commit | 3626877554b6c567d43336ec49414cedfe487260 (patch) | |
tree | f80c51ec1867fea029b955d85e89e39017f920e3 /src/proto/read.cc | |
download | hello-nix-3626877554b6c567d43336ec49414cedfe487260.tar.gz |
Initial commit
Diffstat (limited to 'src/proto/read.cc')
-rw-r--r-- | src/proto/read.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/proto/read.cc b/src/proto/read.cc new file mode 100644 index 0000000..f97a39a --- /dev/null +++ b/src/proto/read.cc @@ -0,0 +1,18 @@ +#include <fstream> +#include <iostream> + +#include "example.pb.h" + +int main(int argc, char **argv) { + sample::Example example; + + { + std::fstream input(argv[1], std::ios::in | std::ios::binary); + example.ParseFromIstream(&input); + } + + std::cout << "foo=" << example.foo() << "\n"; + std::cout << "bar=" << example.bar() << std::endl; + + return 0; +} |