Whats the easiest way to convert a long in C to a char*?
Posted
by dh82
on Stack Overflow
See other posts from Stack Overflow
or by dh82
Published on 2010-06-08T15:59:25Z
Indexed on
2010/06/08
16:02 UTC
Read the original article
Hit count: 196
What is the clean way to do that in C?
wchar_t* ltostr(long value) {
int size = string_size_of_long(value);
wchar_t *wchar_copy = malloc(value * sizeof(wchar_t));
swprintf(wchar_copy, size, L"%li", self);
return wchar_copy;
}
The solutions I came up so far are all rather ugly, especially allocate_properly_size_whar_t uses double float base math.
© Stack Overflow or respective owner