is there and function to convent int to char array?
is there and function to convent int to char array?
From Msdn:
Convert an integer to a string.
char *_itoa( int value, char *string, int radix );
Example:
Code:#include <stdlib.h> #include <stdio.h> void main( void ) { char buffer[20]; int i = 3445; long l = -344115L; unsigned long ul = 1234567890UL; _itoa( i, buffer, 10 ); printf( "String of integer %d (radix 10): %s\n", i, buffer ); _itoa( i, buffer, 16 ); printf( "String of integer %d (radix 16): 0x%s\n", i, buffer ); _itoa( i, buffer, 2 ); printf( "String of integer %d (radix 2): %s\n", i, buffer ); _ltoa( l, buffer, 16 ); printf( "String of long int %ld (radix 16): 0x%s\n", l, buffer ); _ultoa( ul, buffer, 16 ); printf( "String of unsigned long %lu (radix 16): 0x%s\n", ul, buffer ); }
TNT
TNT
You Can Stop Me, But You Cant Stop Us All
Or sprintf() of course.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
thanks TNT
how to i use the sprintf();??
char buff[100];
int num = 25;
sprintf(buff, "%i", num);
or even:
sprintf(buff, "Num = %i", num);
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }