Hi,
sprintf (and it's siblings) should be avoided in production code though,
since in newlib these functions are quite large. I'm not sure if this exist
on all platforms, but there is also atoi()'s counterpart itoa().

Cheers,
Martine

Am 05.09.2016 6:44 nachm. schrieb "Marc" <[email protected]>:

Try

sprintf(a_string, "%d",the_int);

:)
Marc


September 5, 2016 6:40 PM, "Adeel Mohammad Malik" <adeel.mohammad.malik@
ericsson.com> wrote:
> atoi() converts from a string to an int. I want to convert an int to a
string.
>
> /Adeel
>
> From: devel [mailto:[email protected]] On Behalf Of Simon Brummer
> Sent: Monday, September 05, 2016 6:36 PM
> To: RIOT OS kernel developers
> Subject: Re: [riot-devel] char* to int and vice versa
>
> Ah okay. You are looking for atoi() ;)
>
> Am 05.09.2016 6:18 nachm. schrieb "Adeel Mohammad Malik" <
[email protected]>:
>
> The char * is a string here. Basically what I want is the equivalent of
sprintf().
>
> /Adeel
>
> From: devel [mailto:[email protected]] On Behalf Of Simon Brummer
> Sent: Monday, September 05, 2016 6:10 PM
> To: RIOT OS kernel developers
> Subject: Re: [riot-devel] char* to int and vice versa
>
> Well, in c any Pointer is an integer. If you want the plain numeric
value, you can just cast the
> pointer to int. There is no conversion function
>
> Am 05.09.2016 5:58 nachm. schrieb "Adeel Mohammad Malik" <
[email protected]>:
>
> Hi,
>
> A quick question, what functions should I use to convert between a char *
and int in RIOT?
>
> /Adeel
>
> _______________________________________________
> devel mailing list
> [email protected]
> https://lists.riot-os.org/mailman/listinfo/devel
>
> _______________________________________________
> devel mailing list
> [email protected]
> https://lists.riot-os.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
[email protected]
https://lists.riot-os.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
[email protected]
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to