I am trying to print characters in the console with the specified coordinates. So far I have used the very ugly one printf("\033[%d;%dH%s\n", 2, 2, "str");But I just needed to ask if C ++ had any other way to do this. The problem is not that it is ugly, the problem arises when I try to make myself a more beautiful function:
void printToCoordinates(int x, int y, string text)
{
printf("\033[%d;%dH%s\n", x, x, text);
}
This does not work even if I resort to (char*). Another problem is that I have to print \nto refresh the page ... I just don't like to use it printfat all.
Similarly, use coutinstead printf, I believe that there should be a fresh way to do it (ideally, it allows me to write a line where I want to on the screen, and, ideally, does not require these strange characters \033[%d;%dH)
So, does any of you have what I'm looking for?
Shawn source
share