Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- 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   <memory.h>                   Required for declarations only
 #include   <string.h>                   Use either string.h or memory.h

 int        memicmp(buf1,buf2,cnt);
 char       *buf1;                       First buffer;
 char       *buf2;                       Second buffer;
 unsigned   cnt;                         Number of characters

    memicmp() performs a case-insensitive lexicographic comparison of
    'cnt' characters of 'buf1' and 'buf2'.  memicmp() differs from
    memcmp() in that case does not count in memicmp(); 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 compares the first 35 characters of 'buffr1'
    and 'buffr2'.

         #include <memory.h>

         char buffr1[30] = "Now is the time for all good men...";
         char buffr2[30] = "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