Hi,

I'd just like to remind everyone about an important part of localization - 
setlocale(). I've been chasing a few bugs in the tree caused by people not 
using setlocale().

When should you use it? At least before and after every sprintf() that has a 
numeric value. We've got to make sure that these formatted numbers work 
right (our number parsing routines don't know what to do with 8,500in and 
they shouldn't have to - 8.500in is the standard we're sticking to).

setlocale(LC_NUMERIC, "C"); // set locale to C
sprintf(buf, "%.4f", float_foo);
setlocale(LC_NUMERIC, ""); // reset locale

Thanks,
Dom
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


Reply via email to