memicmp

From RAD Studio
Jump to: navigation, search

Go Up to mem.h Index


Header File

mem.h, string.h

Category

Memory and String Manipulation Routines

Prototype

int memicmp(const void *s1, const void *s2, size_t n);

Description

Compares n bytes of two character arrays, ignoring case.

memicmp is available on UNIX System V systems.

memicmp compares the first n bytes of the blocks s1 and s2, ignoring character case (upper or lower).

Return Value

memicmp returns a value that is

  • < 0 if s1 is less than s2
  • = 0 if s1 is the same as s2
  • > 0 if s1 is greater than s2

Example

#include <stdio.h>
#include <string.h>
int main(void)
{
   char *buf1 = "ABCDE123";
   char *buf2 = "abcde456";
   int stat;
   stat = memicmp(buf1, buf2, 5);
   printf("The strings to position 5 are ");
   if (stat)
      printf("not ");
   printf("the same\n");
   return 0;
}

Portability

POSIX Win32 ANSI C ANSI C++

+