Using PutObject with stdin (eg passing std::cin to request.SetBody(). #3072
-
I would like to write a program that uses S3 PutObject function and use stdin as the data source, but it is not possible to make an AWS::IOStream from std::cin and SetBody() (from StreamingS3Request) wants an IOStream and not an IStream. I would like to use my program in a pipeline, but it looks like I can't do that... What sort of workarounds are possible? I can't just save the pipeline to a file -- it could be too big and/or cause other trouble (like being on a file system currently being backed up, etc.). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can set a StringStream with the input that you want to use and then pass that to SetBody(). Here is a code snippet that I got working to show you how to do this: std::shared_ptr<Aws::IOStream> inputData = Aws::MakeShared<Aws::StringStream>("allocTag");
Aws::String sTemp;
std::getline(std::cin, sTemp);
*inputData << sTemp;
request.SetBody(inputData); Let me know if you have any more questions about how to use this sdk. |
Beta Was this translation helpful? Give feedback.
You can set a StringStream with the input that you want to use and then pass that to SetBody(). Here is a code snippet that I got working to show you how to do this:
Let me know if you have any more questions about how to use this sdk.