Though not directly an sdl question I have come to need dynamic strings
to work with sfont and things with sdl, I figgured you guys would be
able to answer this rather simply.
I am used to declaring and reading/writing to a string in this
fassion…
char* str;
sprintf (str,"%i",1234);
etc…
However I find that segfaults, as does any attempt to write to char*
post declaration as apparently gcc makes it a const char* instead.
However if I do a calloc and specify the specific size it will be fine,
as such…
char* str = (char*)calloc(10,sizeof(char));
so the question is, to I have to alloc all my strings? or is there a
better/simpler way of dealing with it?–
Matt Pruett <@Matt_Pruett>