It should be noted that the code is Windows specific, I'm not aware of any C/C++ standard way to specify these values.
I've read that this type of action is done by communicating with the terminal emulator, so it is probably not guaranteed to work between all the different terminals on Windows either; though the "Windows Console" is going to be available on all Windows systems, there is a chance that your user has downloaded a bash terminal emulator or similar.