Realloc fail on union

Ho.

Strange that you could access data in both , if you shouldn't...

Found this explanation: docs.microsoft.com/en-us/cpp/cpp/unions

That complicate the design...

For the record: I have been able to make it work using new:

newbuffer = new char[maxStrLen +1];

but I understand it is not the proper way...

I will still work to find the best way...

one question: can I change, on the same object, the usage, or do I have to reconstruct it ?