BYTE* buffer to managed stream? - DOTNET

This is a discussion on BYTE* buffer to managed stream? - DOTNET ; In managed c++, what is the most efficient way to copy the contents of a native buffer (BYTE*) to a managed stream? thanks scott...

+ Reply to Thread
Results 1 to 3 of 3

BYTE* buffer to managed stream?

  1. Default BYTE* buffer to managed stream?

    In managed c++, what is the most efficient way to copy the contents of a
    native buffer (BYTE*) to a managed stream?

    thanks

    scott



  2. Default Re: BYTE* buffer to managed stream?

    >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

    --
    Mattias Sjögren [C# MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

  3. Default Re: BYTE* buffer to managed stream?

    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.


    "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
    news:OVvOL75MIHA.6108@TK2MSFTNGP03.phx.gbl...
    > >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
    >
    > --
    > Mattias Sjögren [C# MVP] mattias @ mvps.org
    > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    > Please reply only to the newsgroup.




+ Reply to Thread

Similar Threads

  1. reading byte stream from network
    By Application Development in forum RUBY
    Replies: 5
    Last Post: 08-22-2007, 06:07 AM
  2. Replies: 8
    Last Post: 03-26-2007, 12:56 PM
  3. Passing a byte[] managed to C++ unmanaged
    By Application Development in forum DOTNET
    Replies: 0
    Last Post: 03-19-2007, 11:58 AM
  4. ADODB.Stream Max Buffer Size?
    By Application Development in forum ADO DAO RDO RDS
    Replies: 0
    Last Post: 02-08-2007, 11:24 AM
  5. Loading an assembly from byte stream
    By Application Development in forum DOTNET
    Replies: 3
    Last Post: 08-05-2006, 08:16 AM