Hi,
I don’t see anything wrong. But make sure that you don’t convert the returned TString to a const char* on the caller’s side - the TString is temporary, and its const char* will be invalid right after the call. So you should copy it to a TString on the caller’s side, or (more efficient) pass the TString to contain the result as an argument. If you remove “delete []delname” you should see a (small) memory leak.
Axel.