[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 249
  • Last Modified:

Converting int to string

I'm developing in C under Linux, and I neeed to a function that converts an integer to a string. This function should be compatible with ANSI C / UNIX C.
I find the itoa function, but it isn't compatible.

Thanks.
0
suidgirl
Asked:
suidgirl
  • 2
1 Solution
 
deightonCommented:
sprintf(buf,"%i",iYourInt);

where buf is your string
0
 
deightonCommented:
#include <stdio.h>

main()
{
/*sprintf example */

      int x = 5;
      char buf[80];


      sprintf(buf,"%i",x);

      printf("\n%s",buf);
      getch();

}
0
 
suidgirlAuthor Commented:
Thanks for the help. It will be very usefull to me.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now