diff options
author | acidtonic <acidtonic@users.noreply.github.com> | 2014-11-04 10:10:54 -0500 |
---|---|---|
committer | acidtonic <acidtonic@users.noreply.github.com> | 2014-11-04 10:10:54 -0500 |
commit | 2ba455f20c8f83f5349b6bbfbbe601e8946aab63 (patch) | |
tree | 8967d93a00daf6d05c4ba29edc19c93a6fbfd2b3 /src/google | |
parent | 53d202f587f329f84ce11c3ce6f8037ccce73f67 (diff) | |
download | protobuf-2ba455f20c8f83f5349b6bbfbbe601e8946aab63.tar.gz protobuf-2ba455f20c8f83f5349b6bbfbbe601e8946aab63.tar.bz2 protobuf-2ba455f20c8f83f5349b6bbfbbe601e8946aab63.zip |
Corrected code example in coded_stream.h
There is an example at the top of the page which contains code that appears to show a user how to create and serialize a message to a file. However the flags to open the file lack the O_CREAT flag which allows creating the file if it doesn't exist. I was troubleshooting a situation where this snippet was used and compiled, but never created a file.
Diffstat (limited to 'src/google')
-rw-r--r-- | src/google/protobuf/io/coded_stream.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 81fabb1d..775c6067 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -49,7 +49,7 @@ // // to identify the file type, then write a length-delimited string. The // // string is composed of a varint giving the length followed by the raw // // bytes. -// int fd = open("myfile", O_WRONLY); +// int fd = open("myfile", O_CREAT | O_WRONLY); // ZeroCopyOutputStream* raw_output = new FileOutputStream(fd); // CodedOutputStream* coded_output = new CodedOutputStream(raw_output); // |