It would be cleaner to pass a buffer from the calling function. Or to have a statically allocated buffer that is re-used every time (static char text[SIZE_OF_STR]).