analysieren Nach dem Codebeispiel https://developers.google.com/protocol-buffers/docs/cpptutorial zeigen sie, wie in einer Proto-Datei im Binärformat analysiert wird. mitIn Textdatei für Google Protocol Buffer
tutorial::AddressBook address_book;
{
// Read the existing address book.
fstream input(argv[1], ios::in | ios::binary);
if (!address_book.ParseFromIstream(&input)) {
cerr << "Failed to parse address book." << endl;
return -1;
}
}
Ich versuchte, die ios::binary
für meine Eingabedatei zu entfernen, die im Textformat ist, aber das immer noch nicht in der Datei zu lesen. Was muss ich tun, um eine Proto-Datei im Textformat einzulesen?