2017-05-15 162 views
2

在Linux上,我使用AWS CPP SDK從S3存儲桶下載23 MB文件,並使用以下代碼。它工作的很好,但我也想獲得下載進度。我在Google上找不到任何示例。我想我需要設置「SetDataReceivedEventHandler)回調。誰能告訴我該功能看起來應該像什麼/我怎麼能實現它並註冊了嗎?謝謝。Amazon AWS CPP SDK獲取S3存儲桶下載進度

GetObjectRequest getObjectRequest; 
    getObjectRequest.SetBucket(bucket.c_str()); 
    getObjectRequest.SetKey(keyName.c_str()); 
    getObjectRequest.SetResponseStreamFactory([&destination](){ 
    return Aws::New<Aws::FStream>(
    "s3file", destination, std::ios_base::out); }); 

    // getObjectRequest.SetDataReceivedEventHandler() <--- How do I use this? 

    GetObjectOutcome getObjectOutcome = SessionClient->GetObject(getObjectRequest); 
    if(getObjectOutcome.IsSuccess()) 
    { 
     std::cout << "<AWS DOWNLOAD> Get FW success!" << std::endl; 
    } 
    else 
    { 
     std::cout << "<AWS DOWNLOAD> Get FW failed: " << getObjectOutcome.GetError().GetMessage() << std::endl; 
     exit(1); 
    } 
+0

這與C有什麼關係?這絕對是無效的C代碼 – UnholySheep

回答

相關問題