convert number to string
Tom Tran
tom.tran@noaa.gov
Thu Dec 18 18:24:00 GMT 2003
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
More information about the Gcc-help
mailing list