Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Managed Memory to array

Status
Not open for further replies.

JRudisill

Programmer
Aug 4, 2003
54
0
0
US
void* bufftempSize = stackalloc uint[TemplateSize];
byte[] blob = new byte[TemplateSize];

Manager.ATBuildMatchTemplate(pImageItem,bufftempSize);
Marshal.Copy((IntPtr) bufftempSize,blob,0,TemplateSize);

I am using the code above to read from memory block. It seems to work except the template that I read back from the array is not right. I think it has something to do with Marshal.Copy().(Changing from managed to unmanaged) Is there a way I can copy the memory to an array without Marshalling?
 
Try using the C# unsafe keyword to surround that bit of code.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top