LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-29-2004, 10:08 AM   #1
biosx
Member
 
Registered: Jul 2002
Location: Chicagoland
Distribution: Gentoo, Ubuntu
Posts: 63

Rep: Reputation: 15
When to use setlocale() ?


I've been browsing some source code for various GNU programs and I've noticed the use of setlocale(). However, you don't see it everywhere.

So I was wondering what the circumstances were to set locales.

I read the man for setlocale() and it didn't help much.

thanks
 
Old 01-29-2004, 10:27 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
setlocale() controls things like output radix display, date & time displays, etc. Most <time.h> functions are sensitive to locale settings, for example.

On a system level, locale (not from setlocale() ) affects collation sequence - the order of sorting as well as a lot of commands.


It allows you to change countries/languages with your code.
 
Old 01-29-2004, 04:44 PM   #3
biosx
Member
 
Registered: Jul 2002
Location: Chicagoland
Distribution: Gentoo, Ubuntu
Posts: 63

Original Poster
Rep: Reputation: 15
Thx for the reply.

So I should worry about using setlocale( ) when I need to do internationalization and also other environment based tweaks?
 
Old 01-31-2004, 06:04 AM   #4
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Primarily cross-country deployment. We work with a major app that was developed to run in places as diverse as Spain & Jamaica. locale settings matter a lot. But these are controlled mainly at the system level.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
setlocale() returns NULL mic Programming 2 11-08-2005 03:49 AM
setlocale pantera Programming 1 07-06-2004 09:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration