Unix Programming - strcoll and locale

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2005 > strcoll and locale





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author strcoll and locale
Vladimir Zolotykh

2005-11-30, 5:55 pm

The following program

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

main(int argc, char * argv [])
{
if (argc > 1)
setlocale(LC_COLLATE, "ru_RU.KOI8-R");
else
setlocale(LC_COLLATE, "C");
printf("%d\n", strcoll("a-name", "aname"));
}

prints -65 if called w/o arguments and does 1 with 'em.
Trying as I could I was unable to understand that. In C locale
as well as in ru_RU.KOI8-R minus-dash is sure preceding any letter.
Could you please help me to get it ?

Using Linux 2.4.27-1-386 GNU/Linux
libc-2.3.2

--
Vladimir Zolotykh
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com