How do I create an Aws::Utils::ByteBuffer from QString for AWS C++ SDK?
Solved
3rd Party Software
-
I'm new to C++ and QT, working with the AWS C++ SDK, the Kinesis PutRecordRequest requires a data property (the message). It takes a Aws::Utils::ByteBuffer. I'm having trouble understanding how to create this from a QString.
-
Hi
What is Aws::Utils::ByteBuffer ?
Seems to be
Array<unsigned char> Aws::Utils::ByteBuffer
So you could loop the string and add to such Array. -
@mrjj said in How do I create an Aws::Utils::ByteBuffer from QString for AWS C++ SDK?:
Array<unsigned char>
Yes, it appears that's what it is. Could I bother you for an example on this?
-
I believe I've got it.
includedand then
typedef Aws::Utils::Array<unsigned char> ByteBuffer; ... Aws::String streamName = "qt"; QString myMessage = "The Message"; Aws::Kinesis::KinesisClient kinesis; Aws::Kinesis::Model::PutRecordRequest k_req; k_req.SetStreamName(streamName); k_req.SetPartitionKey("123"); k_req.SetData(ByteBuffer((unsigned char *)myMessage.toStdString().c_str(),myMessage.length())); auto k_out = kinesis.PutRecord(k_req); ...