You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/04/22 22:31:16 UTC

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #540: MINIFICPP-809: Better support python capabilities and recordreader/wr…

arpadboda commented on a change in pull request #540: MINIFICPP-809: Better support python capabilities and recordreader/wr…
URL: https://github.com/apache/nifi-minifi-cpp/pull/540#discussion_r277460471
 
 

 ##########
 File path: libminifi/src/io/FileStream.cpp
 ##########
 @@ -28,12 +28,15 @@ namespace nifi {
 namespace minifi {
 namespace io {
 
-FileStream::FileStream(const std::string &path)
+FileStream::FileStream(const std::string &path, bool append)
     : logger_(logging::LoggerFactory<FileStream>::getLogger()),
       path_(path),
       offset_(0) {
   file_stream_ = std::unique_ptr<std::fstream>(new std::fstream());
-  file_stream_->open(path.c_str(), std::fstream::out | std::fstream::binary);
+  if (append)
+    file_stream_->open(path.c_str(), std::fstream::in | std::fstream::out | std::fstream::app | std::fstream::binary);
 
 Review comment:
   Why do we need "in" for appending? 
   
   To avoid duplication can it be done like:
   ```
   auto flags  = std::fstream::out | std::fstream::binary;
   if (append) {
     flags |= std::fstream::in | std::fstream::app
   }
   file_stream_->open(path.c_str(), flags);
   ```
   ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services