|ARM Technical Support Knowledge Articles|
If the locale has not been correctly initialized or it is being accidentally overwritten at runtime, you might encounter problems one of the following functions:
A typical problem you might encounter is the function call
0 rather than
Most cases of such behaviour are caused by bypassing the C library standard initialization code, for example, by providing your own
__main() function. The best solution to this is to ensure that the C library's initialization code in
__rt_lib_init() is called correctly. This will setup locale, and any other C library functions which need to be initialized, automatically.
Alternatively you should be able to work around the problem by calling the
setlocale() before calling any function that uses locale functions, for example:
This work around is possible because the
setlocale() function is a stand alone C library function. For more information, please see 'Table 5. Standalone C library functions' from the ARM Compiler toolchain - Using ARM C and C++ Libraries and Floating-Point Support document.
Article last edited on: 2011-04-07 09:51:59
Did you find this article helpful? Yes No
How can we improve this article?