Setlocale
setlocale is a C standard-library function that selects or queries the program’s locale for locale-sensitive operations.
Modern C, Third Edition
setlocale is a C standard-library function that selects or queries the program's current locale for locale-sensitive behavior.
- How it is used
- Selects the locale for locale-sensitive library behavior and prepares extended-character input and output.
- How deep it goes
- Explains startup settings, locale choices, and category scope, without detailing query syntax or error handling.
- Examples
- Uses extended-character output and a multibyte input scanner that converts code points to UTF-8.
- What you can do after
- Apply it via the C standard library to select locale categories for multibyte input and output.
Modern C
setlocale is a C standard library function that queries or changes the locale applicable to specified categories of locale-sensitive operations.
- How it is used
- Uses locale selection to configure runtime conventions and enable extended-character output.
- How deep it goes
- Explains startup defaults and category effects, with a selection example, but does not detail query or return-value behavior.
- Examples
- Shows setlocale(LC_ALL, "") before printing a line containing extended characters and box-drawing symbols.
- What you can do after
- Apply it via the C standard library to select the system default locale for locale-sensitive operations.
Related concepts
- localeconfigures · A locale is a set of language, regional, and cultural conventions governing the interpretation and presentation of textual, numeric, temporal, and monetary data.
Questions about setlocale
What is setlocale?
setlocale is a C standard-library function that selects or queries the program’s locale for locale-sensitive operations.
Which Manning books explain setlocale?
Modern C, Third Edition and Modern C.
What should I know before learning setlocale?
Manning books that teach setlocale usually introduce wctype.h first.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

