long to string in c example:
/*
convert long to string in C language
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
int main()
{
long unsigned int ulong_value = 123456;
const int n = snprintf(NULL, 0, "%lu", ulong_value);
assert(n > 0);
char buf[n+1];
int c = snprintf(buf, n+1, "%lu", ulong_value);
assert(buf[n] == '\0');
assert(c == n);
printf("string: %s",buf);
return 0;
}Source.www:lautturi.com