|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 caused by one of the following functions:
A typical problem you might encounter could be the function call
0 rather than
Most cases of such behavior are caused by bypassing the C library standard initialization code by providing your own
__main() function. The best solution 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 can work around the problem by calling
setlocale() before calling any function that uses locale functions. For example:
This workaround is possible because the
setlocale() function is a standalone C library function. For more information, please see 'Table 5. Standalone C library functions' in the ARM Compiler toolchain, Version 4.1 - Using ARM C and C++ Libraries and Floating-Point Support document.
Article last edited on: 2016-05-31 21:46:30
Did you find this article helpful? Yes No
How can we improve this article?