In base al codice di esempio https://developers.google.com/protocol-buffers/docs/cpptutorial, essi mostrano come analizzare in un file proto che è in formato binario. utilizzandoAnalizza file di testo per 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;
}
}
Ho provato a rimuovere il ios::binary
per il mio file di input che è in formato testo, ma che non riesce ancora a leggere nel file. Cosa devo fare per leggere un proto file in formato testo?