Listing 7 Calling strcoll

#include <stdio.h>
#include <string.h>
#include <locale.h>
#include "locnames.h"

main()
{
      char str1[6], str2[6];
      int i;

      if (setlocale(LC_ALL, LOC_French) == NULL) {
             printf("Can't establish French locale\n");
       }

      printf("Enter two strings: ");
      scanf("%5s %5s", str1, str2);

      i = strcoll(str1, str2);
      if (i == 0) {
             printf("The strings are the same\n");
      }
      else if (i <0) {
             printf("%s < %s\n", str1, str2);
      }
      else {
             printf("%s > %s\n", str1, str2);
      }

      return 0;
}