bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thousands separator


From: KIMURA Koichi
Subject: Re: thousands separator
Date: Thu, 09 Jul 2009 16:06:50 +0900

Hi,

Arnold, struct lconv have some member which is pointer to something.  In MSVC's 
libc (MinGW use the 
MSCVRT.DLL too), thease pointer become a dangling pointer by any locale 
fucntion such as setlocale().
 And you have to copy the variable deeply if you need copy of lconv.

So, 

        loc = *localeconv();    /* Make a local copy of locale numeric info, 
early on */

should write like as following (in Windows box):

        {
                struct lconv *t;
                t = localeconv();
                loc = *t;
                loc.thousands_sep = strdup(t->thousands_sep);
                loc.decimal_point = strdup(t->decimal_point);
                loc.grouping = strdup(t->grouping);
                loc.int_curr_symbol = strdup(t->int_curr_symbol);
                loc.currency_symbol = strdup(t->currency_symbol);
                loc.mon_decimal_point = strdup(t->mon_decimal_point);
                loc.mon_thousands_sep = strdup(t->mon_thousands_sep);
                loc.mon_grouping = strdup(t->mon_grouping);
                loc.positive_sign = strdup(t->positive_sign);
                loc.negative_sign = strdup(t->negative_sign);
        }

hope this help,


-- 
KIMURA Koichi






reply via email to

[Prev in Thread] Current Thread [Next in Thread]