I have a CEdit and I want to extract the data using this.
wchar_t *temp = (wchar_t*)dialog.editbox.GetBuffer(0);
dialog.editbox.ReleaseBuffer();
Now i want to save this text in a object pointer like this:
selectedShape->setText(temp);
This work perfect, but only as long as you are in the scope of the method, because when I do a file save later, the text is not in the object anymore.
Does anybody know how I can save this wchar_t* for later?
The
temppointer is pointing to data that goes out of scope, so you’ll need to dynamically allocate memory to store the value. Something like this should work:Or: