This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
convert number to string
- From: Tom Tran <tom dot tran at noaa dot gov>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 18 Dec 2003 13:09:43 -0500
- Subject: convert number to string
I am trying to convert a number to a string. The C book I have states
that the function is in stdlib.h, For example, the syntax for itoa() is:
char *itoa(int value, char *string, int radix)
Here is my convtst.c:
#include <stdio.h>
#include <stdlib.h>
main()
{
char *s[17];
int x = 1234;
itoa(x, s, 10);
printf("%s\n", s);
return 0;
}
I compiled the program as: gcc convtst.c -oconvtst
gcc gave error: undefined reference to atoi
Is there a function to convert float to string, s.a. ftoa()?, in stdlib
Please help. Thanks.
Tom Tran