You didn't mention whether "restricted" means that the easy functions (printf and friends) aren't available on your (embedded?) platform, or that this is a restriction of the assignment.
Anyways, what you are doing won't work, ever. You're passing in a binary variable (a long), it won't automagically get converted to a string.
Check out this function, found here, a compact itoa function. Some tweaking required to make an ltoa out of it, but it's easy to see how it works.
//return the length of result string. support only 10 radix for easy use and better performance
int my_itoa(int val, char* buf)
{
const unsigned int radix = 10;
char* p;
unsigned int a; //every digit
int len;
char* b; //start of the digit char
char temp;
unsigned int u;
p = buf;
if (val < 0)
{
*p++ = '-';
val = 0 - val;
}
u = (unsigned int)val;
b = p;
do
{
a = u % radix;
u /= radix;
*p++ = a + '0';
} while (u > 0);
len = (int)(p - buf);
*p-- = 0;
//swap
do
{
temp = *p;
*p = *b;
*b = temp;
--p;
++b;
} while (b < p);
return len;
}