Marc Santhoff <M.Santhoff(at)t-online.de> wrote:
> Die libc hat nl_langinfo(3) um Dinge wie Datumsseparator, etc. zu
> erfahren. Um die Abhängigkeit von libc zu vermeiden und hübsch portabel
> zu bleiben möchte ich die äquivalenten POSIX-Funktionen für solche
> Zwecke verwenden. Welche ist bzw. sind das?
Dafür gibt es die entsprechenden locale-Funktionen. Die
sind nicht nur POSIX, sondern sogar ISO-C90-Standard.
Als ersten Anlaufpunkt würde ich Dir die setlocale(3)-
manpage empfehlen.
Für lokale Datumsangaben (z.B. Monatsnamen in der jeweili-
gen Landessprache) brauchst Du nur folgendes:
setlocale (LC_TIME, "");
und schon wird das Locale aus dem Environment übernommen
(z.B. »de_DE.ISO8859-1«), und Du kannst danach ganz normale
strftime(3) verwenden.
Gruß
Olli
-- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. (On the statement print "42 monkeys" + "1 snake":) By the way, both perl and Python get this wrong. Perl gives 43 and Python gives "42 monkeys1 snake", when the answer is clearly "41 monkeys and 1 fat snake". -- Jim Fulton To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org with "unsubscribe de-bsd-questions" in the body of the messageReceived on Thu 07 Apr 2005 - 13:15:45 CEST