473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

memcmp()

Hi,

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

Regards,
Mads
Nov 15 '05 #1
2 8019
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mads Jacobsen" <ma***********@pol.dk> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
Hi,

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

Regards,
Mads

Nov 15 '05 #2
"Mads Jacobsen" <ma***********@pol.dk> wrote in news:uxcxkSJyDHA.1272
@TK2MSFTNGP12.phx.gbl:
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
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: rajkumar | last post by:
I have a struct like struct MyStruct { int a; int b; int c: bool d; bool e; }
4
by: blueblueblue2005 | last post by:
hi, I am reading the description of memcmp and strcmp, it seems there is no big difference between these two functions. except that memcmp takes void pointer parameters. so why string.h has these...
6
by: Sidney Cadot | last post by:
Hi all, Just browsing through my newly-acquired C99 spec, I was reading on the memcmp() function (7.21.4.1). It has a rather peculiar wording: int memcmp(const void *s1, const void *s2, size_t...
7
by: Alex Stark | last post by:
Hi, I'm new to c# an missing functions like memcmp and memcpy from C. Is there something similar ? cu Alex
4
by: Preets | last post by:
Hi, Can anybody please tell me the difference between memcmp() and strncmp() functions ?
1
by: sahilmakkar | last post by:
can anybody tell me what is difference between memcmp and strcmp which one is better efficient and when to use memcmp or strcmp
4
by: system55 | last post by:
which of the 2 commands are applicable in comparing an array of unsigned chars? if(strcmp(aAbsCylNumHigh, bAbsCylNumHigh)<=0 && strcmp(aAbsCylNumLow,bAbsCylNumLow)<=0 && strcmp(aSecNum,.bSecNum)<0...
13
by: kolmogolov | last post by:
/* Hi, I have removed things irrelevant to reproducing the problem. What's wrong with my code? Thanks in advance for any hint! 1166425362 */ #include <stdio.h> #include <stdlib.h> #include...
39
by: Martin | last post by:
Please consider the following code fragment. Assume UINT32 is a typedef suitable for defining variables of 32 bits, and that ui32 is initialised. UINT32 ui32; /* ... */ /* assume ui32 now is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.