Re: convert number to string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux