Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>memcmp() compare characters from two buffers</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 memcmp()                Compare Characters from Two Buffers

 #include   <mem.h>                      Required for declarations only
 #include   <string.h>                   Use either string.h or memory.h

 int        memcmp(buf1,buf2,cnt);
 const void *buf1;                       First buffer
 const void *buf2;                       Second buffer
 size_t     cnt;                         Number of characters

    memcmp() compares 'cnt' characters of 'buf1' and 'buf2'. The
    comparison is such that 'a' is less than 'b', 'b' is equal to 'b',
    and 'c' is greater than 'b'.

       Returns:     A value indicating the relationship between the two
                    buffers:

                         Result       Value Returned
                    'buf1' < 'buf2'         < 0
                    'buf1' == 'buf2'          0
                    'buf1' > 'buf2'         > 0

         Notes:     Case matters: 'a' does not equal 'A'.

   -------------------------------- Example ---------------------------------

    The following statements compare the first 100 bytes of 'buffr1' and
    'buffr2'.

           #include <mem.h>

           char buffr1[100], buffr2[100];
           int comp;

           main()
           {
               comp = memcmp(buffr1,buffr2,100);
           }


See Also: memccpy() memchr() memcpy() memset()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson