I would need a dynamic pointer string at the end and i know that with sprinf and family i should use a char array.
Its compiling and working this way but i prefer to ask you if its ok to do it like this because i know that with pointers we can have undefined behaviour.
int main ()
char * buffer = (char*) calloc (512, sizeof(char));
char * str = "hello ";
sprintf (buffer, "\n%s%s", str, "world\n");
cout << buffer << endl;