Dynamic Cursor Shifting and Outputing

I am attempting to write a length of code to disply several playing cards side by side AFTER the previous one has already been output. This is using a combination of the ANSI escape codes to shift the cursor up( /0x1b[nA, where n is the number of lines) and over( /0x1b[nC, where n is the number of spaces).

The trouble I am having is inputting a dynamic n value for bumping the cursor over. For example if i wanted to shift it over 3 spaces, n would be '3' or 51. and I do not know of a way of adding another '3' after the value of n reaches into the double digits. n = "10" = '1','0' = 49,48.

Sample playing card:
╔═══╗
║7  ║
║ ♥ ║
╚═══╝


ANSI escape code:
https://en.wikipedia.org/wiki/ANSI_escape_code
Last edited on
Have you looked at ncurses library? It is supposedly a simpler interface to that kind of operations.
I would gladly attempt to learn that library if someone could point me to a good tutorial, I've been searching for one but I haven't been able to find one that touches on what I'm trying to do.
Topic archived. No new replies allowed.