The following routine manages a global CStringArray, Message. It simply replaces the CString at the specified index in Message with the new CString, string. My question is this - How should I correctly delete the old CString in Message which is being replaced? Does this code completely free up the old CString when this routine is exited? Is there a better, correct way of doing it?
void SetMessage(short index, CString string)
pa = Message.GetAt(index); // get old CString
Message.SetAt(index,string); // insert new CString
pa.Empty(); // empty the original element at 'index'