Convert Integer to String and vice versa

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Convert Integer to String and vice versa

1,982 Views
SebaS
Contributor III
Hi, folks!

Well, I'm working with HCS12, with CodeWarrior compiler and I'm progamming it in C language.
Now I need to convert a string to integer, and then an integer to string. I've been told that I should use the atoi() and itoa() functions.... And in order to do that I must include "stdio.h" and "stdlib.h".
The problem is that it says that itoa doesn't exist. I guess it means that it's not in "stdlib.h"...So I downloaded another version of "stdlib.h" that has the itoa() function..... You won't beleive that, but this "stdlib.h" I've downloaded does not have the other function atoi().... WHAT CAN I DO??????

PS: I try to copy what I thought was the declaration of the missing function from the other header but it still doesn't work.

THANKS
Labels (1)
0 Kudos
2 Replies

445 Views
sjmelnikoff
Contributor III
There's no such function as itoa() in the standard C libraries. You could use sprintf() instead, though it may be more efficient to write your own function.
 
Steve Melnikoff.
0 Kudos

445 Views
Alban
Senior Contributor II
You can start by searching for your function name with the Forum search.
It will give you the C code of the function to include in your project..........
0 Kudos