Is there a way thorough which I can see what character occupies a certain coordinate. Let’s say I have the following output:
Hello World !
I want to able to to see the x character on the y line. Something like:
readCoordinates(0,3);
This function should return ‘l’ , because the 4th character (because I started counting from 0) from the 1st line is ‘l’. Can I do this type of readings in C++ from an already printed string ?
You might consider defining your own custom print function, which logs in a
vectoreverything you’ve already outputted to the console. That way, you could easily grab a character, or string, from the console.It might take up a lot of memory, however, if you’re outputting thousands of lines.