I have a simple csv file that I am trying to read using protobuf. For some reason it fails at ParseFromIstream
test-data.csv
col1 col2 col3
1 2 3
fstream in("/input/test-data.csv", ios::in | ios::binary);
if (!in) {
std::cerr << "Failed to open file." << std::endl;
return 1;
}
modelspec::v1::ParameterValue pv;
if (!pv.ParseFromIstream(&in)) {
std::cerr << "Failed to parse protobuf data." << std::endl;
return 1;
}
Protofile definition is below
message ParameterValue {
// Name of the parameter
string name = 1;
// Value of the parameter
oneof value {
string stringValue = 2;
int64 intValue = 3;
FixedPrecision fixedPrecisionValue = 4;
}
}