If a c-str is created dynamically (calloc/malloc), we can't get it's memory size dynamically in any way. :'(
http://stackoverflow.com/questions/419022/char-x256-vs-char-malloc256sizeofchar
#include <stdio.h>
#include <stdlib.h>
int main()
{
char a[512];
char *b = (char*) calloc(1, 512);
printf("%d %d %d\n", sizeof(a), sizeof(b), sizeof(*b));
return 0;
}
512 8 1