I have an object that implements the interface Windows::Storage::Streams::IBuffer
, and I want to get an array of bytes out of it, however while looking at the d
This is a C++/CX version:
std::vector getData( ::Windows::Storage::Streams::IBuffer^ buf )
{
auto reader = ::Windows::Storage::Streams::DataReader::FromBuffer(buf);
std::vector data(reader->UnconsumedBufferLength);
if ( !data.empty() )
reader->ReadBytes(
::Platform::ArrayReference(
&data[0], data.size()));
return data;
}
For more information see Array and WriteOnlyArray (C++/CX).