0
在Visual Studio 2015中以C++編寫的以下代碼崩潰。我使用v 1.1.1
代替AWSSDKCPP-Trasnfer
到NuGet
。我無法通過網絡或使用C++ SDK使用傳輸管理器的適當文檔找到任何示例代碼。如果我的部分出現了錯誤,請將我指向它。AWS-SDK-CPP:傳輸管理器文件下載崩潰
// download a single file from aws s3 bucket
// use transfer manager
// assume Aws::InitAPI() has already been called
int downloadFile(const Aws::String &bucketName, const Aws::String &objectKey) {
auto s3Client = Aws::MakeShared<Aws::S3::S3Client>(S3_CLIENT_TAG);
TransferManagerConfiguration transferConfig;
transferConfig.s3Client = s3Client;
// lambda for download progress callback
transferConfig.downloadProgressCallback =
[](const TransferManager*, const TransferHandle& handle)
{ std::cout << handle.IsMultipart() << std::endl; };
// the fabled transfer manager
TransferManager transferManager(transferConfig);
auto transferHandle = transferManager.DownloadFile(bucketName, "sample.txt", "sample.txt");
transferHandle->WaitUntilFinished(); // block calling thread until download complete
return 0;
}