[英]Convert from IBuffer to const unsigned char in C++ (WinRT)
我想从 C# 转换为 C++ 并再次将缓冲区返回到 C# 如何将 IBuffer 转换为“const unsigned char *data”并再次转换为 IBuffer
Windows::Storage::Streams::IBuffer^ Decode(Windows::Storage::Streams::IBuffer^ buff, int len, int frame_size, int decode_fec);
Windows::Storage::Streams::IBuffer^ MyApi::Decode(Windows::Storage::Streams::IBuffer^ buff, int len, int frame_size, int decode_fec)
{
}
您可以通过查询IBufferByteAccess接口然后访问 IBufferByteAccess::Buffer以获取其内容作为字节来访问 IBuffer 的内容 *
IUnknown* pUnk = reinterpret_cast<IUnknown*>(buff);
IBufferByteAccess* pBufferByteAccess = nullptr;
HRESULT hr = pUnk->QueryInterface(IID_PPV_ARGS(pBufferByteAccess);
byte *pbytes = nullptr;
hr = pBufferByteAccess->Buffer(&pbytes);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.