Example (localeconv -- Retrieve Information from the Environment)

This example prints out the default decimal point for your locale and then the decimal point for the French locale.

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#if (1 == __TOS_OS2__)
   #define LOCNAME "fr_fr.ibm-437"      /* OS/2 name */
#else
   #define LOCNAME "fr_fr.ibm-1252"  /* Windows name */
#endif
int main(void)
{
   struct lconv *mylocale;
   mylocale = localeconv();
   printf("Default decimal point is a %s\n", mylocale->decimal_point);
   if (NULL == setlocale(LC_ALL, LOCNAME)) {
      printf("Locale \"%s\" could not be loaded\n", LOCNAME);
      exit(1);
   }
   mylocale = localeconv();
   printf("France's decimal point is a %s\n", mylocale->decimal_point);
   return 0;
   /*******************************************************************
      The output should be similar to:
      Default decimal point is a .
      France's decimal point is a ,0
   *******************************************************************/
}