*
*Home|Chinese|Japanese*About ARM|Forums|Events|News|Employment|Contact Us|Investors*
dotted rule
*ARM - the architecture for the digital worldARM - the architecture for the digital world
search
*
*
***
*MARKETS:PRODUCTS & SOLUTIONS:CONNECTED COMMUNITY:TECHNICAL SUPPORT:DOCUMENTATION*
*
technical support
*
*
****
*.Technical Support
*
*
*>>Home Page*
*
*.Obtaining Support*
*
*.FAQs*
*
**Development Tool FAQs*
**IP FAQs*
**Embedded Software FAQs*
**Artisan Physical IP FAQs (Login Required)*
*
*.Downloads*
*
*.Documentation*
*
*.Training*
*
*.Where To Buy*
*
*.Keil MCU Tools*
*
*.What's New*
*
*.ARM Newsgroups*
*
*.Active Assist On-site Services*
*
*
*
technical support FAQsask ARM*
*

Technical Support Search
*     (Advanced Search)
  FAQs   Documentation   Downloads   Forums

*

 
downarrowC library character and string function problems
Applies to: ARM Developer Suite (ADS), Compilers, General Build Issues, Libraries, RealView Developer Kit (RVDK) for OKI , RealView Developer Kit (RVDK) for ST, RealView Developer Kit for XScale (RVXDK), RealView Developer Suite (RVDS) 2.0, RealView Developer Suite (RVDS) 2.1, RealView Developer Suite (RVDS) 2.2, RealView Development Suite (RVDS) 3.0, RealView Development Suite (RVDS) 3.1, RealView Development Suite (RVDS) 3.1 Professional, Software Development Toolkit (SDT)

If you encounter problems at runtime with the C library character handling functions from ctype.h,
e.g. isdigit()toupper()tolower()
or string conversion functions from stdlib.h,
e.g. atoi()atof()
or string i/o functions,
e.g. sscanf() and sprintf()
this normally arises because the locale has not been correctly initialized or it is being accidentally overwritten at runtime.

A typical problem might be when the call isdigit('1') returns 0 rather than 1.

Most cases of such behaviour are caused by bypassing the C library standard initialization code, e.g., 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 may be able to work around the problem by using:

  #include <locale.h>
setlocale(LC_ALL,"C");

However this is not recommend, especially as this will pull in additional parts of locale which may not be needed in your system (potentially around 1.4KB extra). It also leaves the possibility of other parts of the C library remaining uninitialized which may lead to later problems.






back to top

*
**
*4 dots*Other ARM Websites | Help with Accessibility
*
shadow *LEGAL STATEMENTshadow