This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: 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:24:14 -0500
- Subject: Re: convert number to string
- References: <3FE1ED66.750255B7@noaa.gov>
Please disregard the question. I can use sprintf() to convert number to
string.
Thank you.
Tom Tran
Tom Tran wrote:
> 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