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 strcmp( const char *s1, const char *s2 );
    int _fstrcmp( const char __far *s1,
                  const char __far *s2 );
    #include <wchar.h>
    int wcscmp( const wchar_t *s1, const wchar_t *s2 );
    #include <mbstring.h>
    int _mbscmp( const unsigned char *s1,
                 const unsigned char *s2 );
    int _fmbscmp( const unsigned char __far *s1,
                  const unsigned char __far *s2 );

Description:
    The strcmp function compares the string pointed to by s1 to the string
    pointed to by s2.

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

    The wcscmp function is a wide-character version of strcmp that operates
    with wide-character strings.

    The _mbscmp function is a multibyte character version of strcmp that
    operates with multibyte character strings.

Returns:
    The strcmp 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", strcmp( "abcdef", "abcdef" ) );
        printf( "%d\n", strcmp( "abcdef", "abc" ) );
        printf( "%d\n", strcmp( "abc", "abcdef" ) );
        printf( "%d\n", strcmp( "abcdef", "mnopqr" ) );
        printf( "%d\n", strcmp( "mnopqr", "abcdef" ) );
      }

    produces the following:

    0
    1
    -1
    -1
    1

Classification:
    strcmp is ANSI, _fstrcmp is not ANSI, wcscmp is ANSI, _mbscmp is not
    ANSI, _fmbscmp is not ANSI

Systems:
     strcmp - All, Netware

    _fstrcmp - All
    wcscmp - All
    _mbscmp - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32
    _fmbscmp - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

See Also:
    strcmpi, stricmp, strncmp, strnicmp

See Also:

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