I see. You were talking about handling a change in how the particular user event of "hitting the backspace key" is presented to the software by the keyboard layout/driver and interpreted by the implementation. I did misunderstand. As far as that goes, nothing so simple is going to work; the wireless keyboard and drivers I use send a control key, an interpreted key ('\b'), and another control key which the implementation of 'CONIO' I have on hand prints, using the posted source, as "^^".
If the if-statement is [...] some other contol-code.
You've excluded all source. No code, no matter how conforming, will run exactly as the standard specifies on every platform. I can, at my leisure, write fully conforming C++ that will not compile and run on any platform I have at my disposal. That definition of valid is meaningless. Invalid code would be something that the standard strictly forbids.
Well, yeah, I suppose. But note [...] between platforms.
The code provided [...]defined in some manner.
I suppose the middle [...] original poster left out.
The code provided doesn't have a 'main' either. That doesn't change the validity of the sample.
I suppose the middle [...] the original poster left out.
The blue colored code is changed.
Now move the terminating condition, the 'if' statements around the 'break', directly to the condition of the 'while' statement.
Don't pointlessly over-allocate, if you are going to stick with the constant (30); allocate the smaller of 31 or 'strSize + 1'.
If he uses the right construct he only needs to change three lines four lines or abut 60 70 characters.
To use this function [...] require a LOT of workaround, in my mind.