This is about the string class function that returns a char * (null-terminated).

char *MYSTRING::c_str();

I thought it would be easy but I am having a few roadblocks:

1) If I declare a local array and set it up correctly, I can't return a reference or a pointer to it. Also, since the size is variable, I can't create an array in the first place.

2) Only thing left is dynamic memory allocation. However, that leads to a memory leak.

So... how else can I return a null-terminated c string? The guts of my class use a char array but it isn't null-terminated so I can't return that...