You said you wanted a conversion from int to char but your funtion returned a string. I'm working under the assumption you want a char. This is the long answer to the short quesion:
Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
char * INTtoCHAR(int IntBuffer);
void IntToCharNoItoa(int IntBuffer, char cBuff[] ) ;
int main()
{
char cInt[20];
strcpy( cInt, INTtoCHAR( 100 ) ); //no better than itoa below
itoa( 101, cInt, 10 );//you're just using the c runtime library
IntToCharNoItoa( 461, cInt );// this loads the char array with the integer
return 0;
} // end
char * INTtoCHAR(int IntBuffer)
{
char szBigNum[ 12 ] = { 0 };
return _itoa( IntBuffer, szBigNum, 10 );
}
void IntToCharNoItoa(int IntBuffer, char cBuff[] )
{
for( int i = 0; IntBuffer % 10; i++ ) //until IntBuffer modulas is 0
{
cBuff[ i ] = '0' + IntBuffer % 10;// insert one decimal digit from IntBuffer
//plus the ascii '0' to get the correct ascii number value
IntBuffer /= 10;//reduce IntBuffer by one decimal digit
}
cBuff[ i ] = '\0';// terminate the string
strrev( cBuff );//its in reverse order so reverse it
//english text is left to right numbers right to left
}