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/C++ v10.0 : C library - <b>synopsis:</b> 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 );

Description:
    The strncmp and _fstrncmp functions compare 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.

Returns:
    The strncmp and _fstrncmp functions return 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.

See Also:
    strcmp, _fstrcmp, stricmp, _fstricmp, strnicmp, _fstrnicmp

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

Systems:
     strncmp - All

    _fstrncmp - All

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