[Previous]
[Contents]
[Next]

memicmp(), _memicmp(), _fmemicmp()

compare a given number of characters of two objects, without case sensitivity

Synopsis:

#include <string.h>
int memicmp( const void *s1,
             const void *s2,
             size_t length );
int _memicmp( const void *s1,
              const void *s2,
              size_t length );
int _fmemicmp( const void __far *s1,
               const void __far *s2,
               size_t length );

Description:

The memicmp() function compares, with case insensitivity (upper- and lowercase characters are equivalent), the first length characters of the object pointed to by s1 to those of the object pointed to by s2.

The _fmemicmp() function is a data-model-independent form of the memicmp() function that accepts far pointer arguments. It is most useful in mixed memory model applications.

The _memicmp() function is identical to memicmp() but uses ANSI/ISO naming conventions.

Returns:

An integer, with the value given below:

Less than 0
the object pointed to by s1 is less than the object pointed to by s2.
0
the object pointed to by s1 is equal to the object pointed to by s2.
Greater than zero
the object pointed to by s1 is greater than the object pointed to by s2.

Examples:

#include <stdio.h>
#include <string.h>

void main()
  {
    char buffer[80];

    strcpy( buffer, "World" );
    if( memicmp( buffer, "hello", 5 ) < 0 ) {
      printf( "Less than\n" );
    } else {
      printf( "Equal to or greater than\n");
    }
  }

produces the output:

Equal to or greater than

Classification:

WATCOM

_memicmp() conforms to ANSI/ISO naming conventions.

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

memchr(), memcmp(), memcpy(), memset()


[Previous]
[Contents]
[Next]