Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/b/bcmp.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/b/bcmp.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/b/bcmp.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/b/bcmp.html on line 8

bcmp()

Compare a given number of characters in two strings

Synopsis:

#include <strings.h>

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

Arguments:

s1, s2
The strings you want to compare.
n
The number of bytes to compare.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The bcmp() function compares the byte string pointed to by s1 to the string pointed to by s2. The number of bytes to compare is specified by n. NUL characters may be included in the comparison.


Note: This function is similar to the ANSI memcmp() function, but tests only for equality. New code should use the ANSI function.

Returns:

0
The byte strings are identical.
1
The byte strings aren't identical.

Examples:

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

int main( void )
  {
    if( bcmp( "Hello there", "Hello world", 6 ) ) {
      printf( "Not equal\n" );
    } else {
      printf( "Equal\n" );
    }
    return EXIT_SUCCESS;
  }

produces the output:

Equal

Classification:

POSIX 1003.1 XSI

Safety:
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

bcopy(), bzero(), memcmp(), strcmp()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/b/bcmp.html on line 170

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/b/bcmp.html on line 170