title: write a steam to disk in c++ in chunks
body: <p>I am quite new to the C++ world, and I am trying to write a file stream to a disk.I am able to do the following:</p>
  <pre><code>  const Aws::String objectKey2(&quot;filename.tar&quot;);
    Aws::S3::S3Client s3_client2;
    Aws::S3::Model::GetObjectRequest object_request2;
    object_request2.SetBucket(bucket_name);
    object_request2.SetKey(objectKey2);
    Aws::S3::Model::GetObjectOutcome get_object_outcome2 =
        s3_client2.GetObject(object_request2);
    auto &amp;retrieved_file2 = get_object_outcome2.GetResult().GetBody();
  
  
    std::ios_base::sync_with_stdio(false);
    auto myfile = std::fstream(&quot;file.tar&quot;, std::ios::out | std::ios::binary);
    myfile.write((char*) &amp;retrieved_file2, 1024*100);
    myfile.close();
  </code></pre>
  <p>But this is writing some 1k to disk and the file is unreadable (obviously). The file is a tar from from aws s3, which I try to write to disk in chunks.</p>