Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <string.h>
    int strncmp( const char *s1,
                 const char *s2,
                 size_t n );
    int _fstrncmp( const char __far *s1,
                   const char __far *s2,
                   size_t n );
    #include <wchar.h>
    int wcsncmp( const wchar_t *s1,
                 const wchar_t *s2,
                 size_t n );
    #include <mbstring.h>
    int _mbsncmp( const unsigned char *s1,
                  const unsigned char *s2,
                  size_t n );
    int _fmbsncmp( const unsigned char __far *s1,
                   const unsigned char __far *s2,
                   size_t n );

Description:
    The strncmp compares not more than n characters from the string pointed
    to by s1 to the string pointed to by s2.

    The _fstrncmp function is a data model independent form of the strncmp
    function that accepts far pointer arguments.  It is most useful in mixed
    memory model applications.

    The wcsncmp function is a wide-character version of strncmp that
    operates with wide-character strings.

    The _mbsncmp function is a multibyte character version of strncmp that
    operates with multibyte character strings.

    The _fmbsncmp function is a data model independent form of the _mbsncmp
    function that accepts far pointer arguments.  It is most useful in mixed
    memory model applications.

Returns:
    The strncmp function returns an integer less than, equal to, or greater
    than zero, indicating that the string pointed to by s1 is less than,
    equal to, or greater than the string pointed to by s2.

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

    void main()
      {
        printf( "%d\n", strncmp( "abcdef", "abcDEF", 10 ) );
        printf( "%d\n", strncmp( "abcdef", "abcDEF",  6 ) );
        printf( "%d\n", strncmp( "abcdef", "abcDEF",  3 ) );
        printf( "%d\n", strncmp( "abcdef", "abcDEF",  0 ) );
      }

    produces the following:

    1
    1
    0
    0

Classification:
    strncmp is ANSI, _fstrncmp is not ANSI, wcsncmp is ANSI, _mbsncmp is not
    ANSI, _fmbsncmp is not ANSI

Systems:
     strncmp - All, Netware

    _fstrncmp - All
    wcsncmp - All
    _mbsncmp - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32
    _fmbsncmp - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

See Also:
    strcmp, stricmp, strnicmp

See Also:

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