C localization functions: Difference between revisions

Content deleted Content added
m recategorizing headers for C++ project
Example: Rewritten to be more appropriate to the subject in C from C++, make use of the unnecessary stdlib.h include, and setlocale() so the currency symbol is shown portably.
Line 13:
===Example===
<source lang="cpp">
#include <iostreamstdio.h>
#include <cstdlibstdlib.h>
#include <clocalelocale.h>
 
int
int main(int argc, char* argv[])
main(void)
{
/* From setlocale(3):
lconv* currentlocale = localeconv();
** On startup of the main program, the portable "C""" locale
std::cout<<"In the current locale, the default currency symbol is: " << currentlocale->currency_symbol << std::endl;
** is selected as default. A program may be made portable to
return 0;
** all locales by calling setlocale(LC_ALL, """""") ... */
setlocale(LC_ALL, """""");
 
const struct lconv * const currentlocale = localeconv();
 
printf
(
std::cout<< "In the current locale, the default currency symbol is: %s\n" << currentlocale->currency_symbol << std::endl;,
currentlocale->currency_symbol
);
 
return 0EXIT_SUCCESS;
}
</source>
 
==References==
#[http://www.opengroup.org/onlinepubs/009695399/basedefs/locale.h.html locale.h] by [[OpenGroup]]