Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Nov 2000 09:50:48 +0100
From:      Cejka Rudolf <cejkar@dcse.fee.vutbr.cz>
To:        Mikhail Teterin <mi@privatelabs.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: setting locale
Message-ID:  <20001130095048.A50821@dcse.fee.vutbr.cz>
In-Reply-To: <no.id>; from mi@privatelabs.com on Wed, Nov 29, 2000 at 05:02:30PM -0500

next in thread | previous in thread | raw e-mail | index | archive | help
Mikhail Teterin wrote (2000/11/29):
> How  do I  make force  my C-program  use the  right locale?  I could  do
> something like:
> 	setlocale(LC_ALL, getenv("LANG"))
> but is not that what specifying NULL is supposed to do?

No. There is a difference between NULL and "" - man setlocale:

     Only three locales are defined by default, the empty string "" which de-
     notes the native environment, and the "C" and "POSIX" locales, which de-
     note the C language environment.  A locale argument of NULL causes
     setlocale() to return the current locale.

... which for "" means that (man setlocale on Solaris) ...

     A value of "" for locale specifies that the locale should be
     taken  from  environment  variables.

-- 
Rudolf Cejka   (cejkar@dcse.fee.vutbr.cz;  http://www.fee.vutbr.cz/~cejkar)
Brno University of Technology, Faculty of El. Engineering and Comp. Science
Bozetechova 2, 612 66  Brno, Czech Republic


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001130095048.A50821>