memcmp()

  • Thread starter Thread starter Mads Jacobsen
  • Start date Start date
Mads,

There is no such function. memcmp compares two pointers in memory to
see if the referenced bytes are the same. This can't be done in C# because
you can not guarantee that a location in memory will always have the same
contents (because of memory management).

However, if you have two byte arrays, you could easily write a routine
that will cycle through the arrays and compare the bytes.

Hope this helps.
 
Hi,

Does anyone know the c#-function of c++'s memcmp()?

Regards,
Mads


If you have an IntPtr either via fixing the memory via the "fixed" verb
or via the GCHandle.AddrOfPinnedObject() method you can then populate it
via the Marshal.Copy() method.

-
Stephen
 
Back
Top