This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

itoa (Int to String)

Hey, please excuse the lack of expertise, but it has been years since i've programmed and I am just getting back into it.

I have 2 questions.

1) Why are the standard libraries for Arm different than other standard C libraries. For example, the stdlib library is missing the itoa() function that is available for other compilers. Can I use these libraries for the Arm or do i need one that is specifically made for the Arm compiler. Another example is string.h, where in the past i remember being able to create a variable using the typedef "string" where as in now i cannot.

2) Is there an easy alternative to converting an integer to a string?

Any help is really appreciated.
Thanks
Omer

2)

Parents
  • Thank you PW for your quick response.
    I tried using #include <string> several times with no avail. Each time i get the following errors:

    C:\Keil\ARM\RV31\INC\rw/_defs.h(781): error: #20: identifier "namespace" is undefined
    C:\Keil\ARM\RV31\INC\rw/_defs.h(781): error: #65: expected a ";"
    C:\Keil\ARM\RV31\INC\wchar.h(107): error: #20: identifier "size_t" is undefined
    C:\Keil\ARM\RV31\INC\wchar.h(107): error: #20: identifier "size_t" is undefined
    C:\Keil\ARM\RV31\INC\iosfwd(93): error: #20: identifier "namespace" is undefined
    C:\Keil\ARM\RV31\INC\iosfwd(93): error: #65: expected a ";"

Reply
  • Thank you PW for your quick response.
    I tried using #include <string> several times with no avail. Each time i get the following errors:

    C:\Keil\ARM\RV31\INC\rw/_defs.h(781): error: #20: identifier "namespace" is undefined
    C:\Keil\ARM\RV31\INC\rw/_defs.h(781): error: #65: expected a ";"
    C:\Keil\ARM\RV31\INC\wchar.h(107): error: #20: identifier "size_t" is undefined
    C:\Keil\ARM\RV31\INC\wchar.h(107): error: #20: identifier "size_t" is undefined
    C:\Keil\ARM\RV31\INC\iosfwd(93): error: #20: identifier "namespace" is undefined
    C:\Keil\ARM\RV31\INC\iosfwd(93): error: #65: expected a ";"

Children
  • Notice that <string> is a C++ include file, and "namespace" is a C++ keyword.

    Are you sure that you are compiling C++ source code, and not C code?

    If you are going to work with C++, I would also recommend that you read up a bit about namespaces, since the C++ runtime library has been moved into the std:: namespace, to follow the current ISO C++ language standard.