Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 469 by wuy...@gmail.com: how to write/read more than one piece of message to/from a text file in c++
http://code.google.com/p/protobuf/issues/detail?id=469

What steps will reproduce the problem?
1.fullfill a message
2.invoke SerializeToString method of this message;
3.open a file with combined mode of "std::ios::app|std::ios::binary" and write the data to this file and close file 4.open file stored the messages in "std::ios::in|std::ios::binary", read a line,and invoke ParseFromString, this ParseFromString will fail.

What is the expected output? What do you see instead?
expected: a parsed message
fact:libprotobuf ERROR ..\src\google\protobuf\message_lite.cc:123] Can't parse message of type "FileState" because it is missing required fields:name,state

What version of the product are you using? On what operating system?
version:protobuf-2.4.0a
system: windows7 x86

Please provide any additional information below.
MESSAGE definition:
enum FileAction {
   FILE_ACTION_ADD = 0;
   FILE_ACTION_DEL = 1;
   FILE_ACTION_MODIFY = 2;
   FILE_ACTION_RENAME = 3;
}

message FileState {
   required string name = 1;     // file name
   required FileAction state = 2;   // file state
}
the test source file will be found in the attached file


Attachments:
        mail.cpp  1.1 KB

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to