It would be easiest to pass a CString object to:

void myfunc (CString sMyString) // sMyString may grow in size with no problem

Next place the following code fragment in the calling function:

CString sMyString;
myfunc(sMyString); // May cast sMyString into LPTSTR if you want. Read document

CString object is often more convenient than char *. It will be destroyed automatically as it goes out of scope.