This can be done with the following console functions: In order to read the console’s input buffer (the record of events that have happened from input, including user input), we have to know how many events there are in order to dynamically allocate memory to store those events.This is where Get Number Of Console Input Events comes.The last thing to mention is that if you update the screen with Write Console Output A every loop, you’ll probably see little flickers as the screen is updated.
The structure called _REDRECTANGLE is typedef’d allowing declaration of variables by skipping writing the annoying legacy struct keyword.
An instance of _REDRECTANGLE called REDRECTANGLE is then declared and initialized with the arrays containing the values for the ASCII characters, and color values.
The image it is writing is called REDRECTANGLE, which is actually a structure defined in a file I’ve written called red Rectangle.h.
The red rectangle is a square of 9 red characters, so to write this square onto where the user clicks, you must use offsetx – 1, and offsety -1, otherwise the top left of the red rectangle image will be placed on the left-click location, instead of the center.
The rest of the type of events we’re going to ignore (and MSDN actually advises this on a couple internally used event types).