>In managed c++, what is the most efficient way to copy the contents of a
>native buffer (BYTE*) to a managed stream?
As of .NET 2.0 you can use the System.IO.UnmanagedMemoryStream. It
wraps the native buffer directly so it doesn't require any copying.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Scott McFadden - 30 Nov 2007 22:57 GMT
Thanks, it appears that the UnmanagedMemoryStream can't be chained to
another stream. Would be nice if you could write a block of native memory
to the UnmanagedStream and have it write to the chained / underlying stream.
> >In managed c++, what is the most efficient way to copy the contents of a
>>native buffer (BYTE*) to a managed stream?
[quoted text clipped - 3 lines]
>
> Mattias