Processing an existing buffer using Stream?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have code that returns a buffer filled with variant data. I've tried using
P/Invoke to process it, but that's just proving frustrating and basically
impossible to debug.

Another way to deal with the problem would be to use a Stream, MemoryStream
seems particularily interesting. However all the methods assume that
MemoryStream is going to create the buffer.

Is there some way to build a MemoryStream on my existing buffer?

Or can someone suggest a better general solution to this problem? I'm going
to be handed an IntPtr to the blob, what's the best way to turn that into
C#-side strings, ints and so forth?
 
Hi Maury,
I have code that returns a buffer filled with variant data. I've tried using
P/Invoke to process it, but that's just proving frustrating and basically
impossible to debug.

Another way to deal with the problem would be to use a Stream, MemoryStream
seems particularily interesting. However all the methods assume that
MemoryStream is going to create the buffer.

Is there some way to build a MemoryStream on my existing buffer?

Yes, the MemoryStream(byte[]) contructor.

bye
Rob
 
Back
Top