Convert Integer to String and vice versa

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Convert Integer to String and vice versa

2,809 次查看
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
标签 (1)
0 项奖励
回复
2 回复数

1,272 次查看
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 项奖励
回复

1,272 次查看
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 项奖励
回复