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>memicmp() compare characters in two buffers</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 memicmp()               Compare Characters in Two Buffers

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

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

    memicmp() performs a case-insensitive comparison of 'cnt' characters
    of 'buf1' and 'buf2'.  memicmp() differs from memcmp() in that case
    does not matter; that is, 'a' equals 'A' in memicmp().

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

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

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

    The following statements compare the first 35 characters of 'buffr1'
    and 'buffr2'.

           #include <mem.h>

           char buffr1[40] = "Now is the time for all good men...";
           char buffr2[40] = "NOW IS THE TIME FOR ALL GOOD MEN...";
           int rslt;

           main()
           {
                rslt = memicmp(buffr1,buffr2,35);
                if (rslt == 0)
                    printf("buffers are equal");
                else
                    printf("buffers are not equal");
           }


See Also: memcmp() memcpy() memset()

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