Will set EmptyText to all spaces for the required length. As EmptyText is to use with TextOut you don't need a terminating NULL as you specify with TextOut the number of chars to display.
However, this is not your problem. The problem you have is that you are writing onto a DC and therefore using the font selected into that DC. On the Console this DC font is NOT the font that the console uses to display console characters (change ' ' in your code to '@' and see what happens!). So if you persist in using gui functions for the console window then you have a whole lot of more work to do. Use the console supplied functions. They are far easier to use.Code:
size_t tlen = p->Text.length();
char *EmptyText = new char[tlen];
memset(EmptyText, ' ', tlen);
The other problem you have is that you assume that each subsequent use of TextOut clears from the screen that which was there before. It doesn't. It writes on top of what was there. So outputing a space over a letter does nothing. Because you haven't selected a correct font to use you only think that TextOut is working properly and the problem is with your EmptyText string. The real problem is with trying to use gui TextOut in the same way as you would output to a console. It doesn't work that way I'm afraid. Once you have your font selected, try outputting a string of A with O as the space character.