home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / lconv.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  3KB  |  75 lines

  1. /***
  2. *lconv.c - Contains the localeconv function
  3. *
  4. *       Copyright (c) 1988-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       Contains the localeconv() function.
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <limits.h>
  13. #include <locale.h>
  14. #if defined (_WIN32)
  15. #include <setlocal.h>
  16. #endif  /* defined (_WIN32) */
  17.  
  18. /* pointer to original static to avoid freeing */
  19. char __lconv_static_decimal[] = ".";
  20. char __lconv_static_null[] = "";
  21.  
  22. /* lconv settings for "C" locale */
  23. struct lconv __lconv_c = {
  24.                 __lconv_static_decimal, /* decimal_point */
  25.                 __lconv_static_null,       /* thousands_sep */
  26.                 __lconv_static_null,       /* grouping */
  27.                 __lconv_static_null,       /* int_curr_symbol */
  28.                 __lconv_static_null,       /* currency_symbol */
  29.                 __lconv_static_null,       /* mon_decimal_point */
  30.                 __lconv_static_null,       /* mon_thousands_sep */
  31.                 __lconv_static_null,       /* mon_grouping */
  32.                 __lconv_static_null,       /* positive_sign */
  33.                 __lconv_static_null,       /* negative_sign */
  34.                 CHAR_MAX,                           /* int_frac_digits */
  35.                 CHAR_MAX,                           /* frac_digits */
  36.                 CHAR_MAX,                           /* p_cs_precedes */
  37.                 CHAR_MAX,                           /* p_sep_by_space */
  38.                 CHAR_MAX,                           /* n_cs_precedes */
  39.                 CHAR_MAX,                           /* n_sep_by_space */
  40.                 CHAR_MAX,                           /* p_sign_posn */
  41.                 CHAR_MAX                               /* n_sign_posn */
  42.                 };
  43.  
  44.  
  45. /* pointer to current lconv structure */
  46.  
  47. struct lconv *__lconv = &__lconv_c;
  48.  
  49. /***
  50. *struct lconv *localeconv(void) - Return the numeric formatting convention
  51. *
  52. *Purpose:
  53. *       The localeconv() routine returns the numeric formatting conventions
  54. *       for the current locale setting.  [ANSI]
  55. *
  56. *Entry:
  57. *       void
  58. *
  59. *Exit:
  60. *       struct lconv * = pointer to struct indicating current numeric
  61. *                        formatting conventions.
  62. *
  63. *Exceptions:
  64. *
  65. *******************************************************************************/
  66.  
  67. struct lconv * __cdecl localeconv (
  68.         void
  69.         )
  70. {
  71.         /* the work is done by setlocale() */
  72.  
  73.         return(__lconv);
  74. }
  75.