Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

strncmp(3)

index(3)

rindex(3)

strcat(3)

strcmp(3)

strcspn(3)

strchr(3)

strcpy(3)

strlen(3)

strncat(3)

strncpy(3)

strpbrk(3)

strrchr(3)

strspn(3)



  strncmp(3)                          CLIX                          strncmp(3)



  NAME

    strncmp - Compares a specified number of character from two strings

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

    #include <string.h>

    int strncmp(
      char * string1 ,
      char * string2 ,
      size_t number );

  PARAMETERS

    string1
           A pointer to a character string

    string2
           A pointer to a character string

    number The number of characters to compare

  DESCRIPTION

    Upon successful completion, the strncmp() function returns an integer
    whose value is greater than, equal to, or less than 0 (zero), according to
    whether the string1 string is greater than, equal to, or less than the
    string2 string.  The strncmp() function compares at most number
    characters.

  EXAMPLES

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

    main()
    {
         if (!strncmp ("abc", "abcde", 3))
              printf ("The strings are equal in the first 3 characters\n");
         else
              printf ("The strings are not equal in the first 3 characters\n");
    }


  RELATED INFORMATION




  2/94 - Intergraph Corporation                                              1






  strncmp(3)                          CLIX                          strncmp(3)



    Functions: index(3), rindex(3), strcat(3), strcmp(3), strcspn(3),
    strchr(3), strcpy(3), strlen(3), strncat(3), strncpy(3), strpbrk(3),
    strrchr(3), strspn(3)



















































  2                                              Intergraph Corporation - 2/94




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026