Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created read.cc #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions read.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <string>
#include "messages.pb.h"

//using namespace std;

int main(int argc, char *argv[]){
// Verify the version of the library
GOOGLE_PROTOBUF_VERIFY_VERSION;

swarm::Data data;


/*
if (!data.ParseFromIstream(&input)) {
cerr << "Failed to parse address book." << endl;
return -1;
}
*/

std::fstream input(argv[1], std::ios::in | std::ios::binary);


if (!data.ParseFromIstream(&input)) {
std::cerr << "Failed to parse address book." << std::endl;
return -1;
}


std::cout<<"x = "<<data.x()<<std::endl;
std::cout<<"y = "<<data.y()<<std::endl;
std::cout<<"vel_x = "<<data.vel_x()<<std::endl;
std::cout<<"vel_y = "<<data.vel_y()<<std::endl;

google::protobuf::ShutdownProtobufLibrary();

return 0;
}