Converting IntPtr to byte[]

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

    #1

    Converting IntPtr to byte[]

    Having trouble figuring out the best way to convert an
    IntPtr to a byte[] without losing any data. Looks like I
    need to use Marshal.PtrToSt ructure(), but I'm not having
    any luck with that.
    Any help would be appreciated.
  • Christoph Schittko [MVP]

    #2
    Re: Converting IntPtr to byte[]

    Does the IntPtr actaully point to a byte[] or is it something else?

    It sounds like you are trying to get the bytes occupied by an object ...

    Can you be more specific what you are trying to do, then I can help better.
    Christoph
    Sofware Architect, .NET Mentor
    MS MVP XML .NET

    "Brian Harleton" <bharleton@xrit e.com> wrote in message
    news:10c801c361 b3$96b0b830$a50 1280a@phx.gbl.. .[color=blue]
    > Having trouble figuring out the best way to convert an
    > IntPtr to a byte[] without losing any data. Looks like I
    > need to use Marshal.PtrToSt ructure(), but I'm not having
    > any luck with that.
    > Any help would be appreciated.[/color]


    Comment

    • jennyq

      #3
      Re: Converting IntPtr to byte[]

      Marshal.Copy ?

      "Brian Harleton" <bharleton@xrit e.com> wrote in message
      news:10c801c361 b3$96b0b830$a50 1280a@phx.gbl.. .[color=blue]
      > Having trouble figuring out the best way to convert an
      > IntPtr to a byte[] without losing any data. Looks like I
      > need to use Marshal.PtrToSt ructure(), but I'm not having
      > any luck with that.
      > Any help would be appreciated.[/color]


      Comment

      Working...