Convert native byte array (pointer) to managed byte[]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    #1

    Convert native byte array (pointer) to managed byte[]

    We are writing some code to interface to a DLL. The DLL
    has a callback method that returns the address of a byte
    buffer and the buffer length. I have defined the byte
    pointer as an IntPtr.

    How do I convert between the IntPtr and my managed byte[]
    that I want to copy the data into???

    -dave
  • Stephen Martin

    #2
    Re: Convert native byte array (pointer) to managed byte[]

    System.Runtime. InteropServices .Marshal.Copy(I ntPtr source, byte[]
    destination, int start, int length)

    "Dave" <dhoffer@xrite. remove.com> wrote in message
    news:10ab01c361 b2$f7501740$a50 1280a@phx.gbl.. .[color=blue]
    > We are writing some code to interface to a DLL. The DLL
    > has a callback method that returns the address of a byte
    > buffer and the buffer length. I have defined the byte
    > pointer as an IntPtr.
    >
    > How do I convert between the IntPtr and my managed byte[]
    > that I want to copy the data into???
    >
    > -dave[/color]


    Comment

    Working...