Computing.Net > Forums > Programming > Converting int to char*

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Converting int to char*

Reply to Message Icon

Name: cernov
Date: May 24, 2004 at 13:07:52 Pacific
OS: Fedora core 1
CPU/Ram: AMD 750Mhz 128 RAM
Comment:

Is there a function who converts any integer to a string (char *). Remember I can't use itoa() because it's a unix-like system



Sponsored Link
Ads by Google

Response Number 1
Name: tommycoolman
Date: May 24, 2004 at 13:49:10 Pacific
Reply:

You can use sprintf(). It's like printf() except it prints to a string instead of stdout. sprintf() works exactly like printf(), except the first parameter is a pointer to a string.

example:
--------
int x=54500;
char string[32];

sprintf(string,"%d",x);
--------

Hope this helps.


0
Reply to Message Icon

Related Posts

See More


Adding blank row in excel... using deltree



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Converting int to char*

Convert int to Char c++ www.computing.net/answers/programming/convert-int-to-char-c/12549.html

Converting int to char www.computing.net/answers/programming/converting-int-to-char/6800.html

convert void* to char www.computing.net/answers/programming/convert-void-to-char-/16145.html