[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: where the hell is itoa()?
- To: Ariel Biener <ariel(at-nospam)fireball.tau.ac.il>
- Subject: Re: where the hell is itoa()?
- From: Adi Stav <stav(at-nospam)actcom.co.il>
- Date: Sun, 15 Jul 2001 12:57:51 +0300
- Cc: Shaul Karl <shaulka(at-nospam)bezeqint.net>, b g <bgbg(at-nospam)md.huji.ac.il>, Linux-IL Mailing List <linux-il(at-nospam)linux.org.il>
- Delivered-To: linux.org.il-linux-il@linux.org.il
- In-Reply-To: <Pine.LNX.4.21_heb2.09.0107142251530.19191-100000@fireball.tau.ac.il>; from ariel@fireball.tau.ac.il on Sat, Jul 14, 2001 at 10:57:04PM +0300
- Mail-Followup-To: Ariel Biener <ariel@fireball.tau.ac.il>,Shaul Karl <shaulka@bezeqint.net>, b g <bgbg@md.huji.ac.il>,Linux-IL Mailing List <linux-il@linux.org.il>
- References: <E15LVGj-0002QK-00@rakefet> <Pine.LNX.4.21_heb2.09.0107142251530.19191-100000@fireball.tau.ac.il>
- Sender: Adi Stav <adi(at-nospam)stav.org.il>
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
- User-Agent: Mutt/1.2.5i
On Sat, Jul 14, 2001 at 10:57:04PM +0300, Ariel Biener wrote:
> On Sat, 14 Jul 2001, Shaul Karl wrote:
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
>
> char *mychar;
> int a=99999; /* Just some random number */
>
> mychar=(char *)calloc(1, sizeof(int));
Just allocate a long enough string buffer -- char[32] should do it even
for long long. sizeof(int) will never be enough.
> sprintf(mychar, "%d%c", a, '\0');
You don't need to explicitly write the null character in sprintf.
> return 1;
> }
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il