Hi
I have a series of printf statements which are displayed on screen; is it possible that i will center these in the middle of the screen (both horizontal and vertical)?
Thank you
Printable View
Hi
I have a series of printf statements which are displayed on screen; is it possible that i will center these in the middle of the screen (both horizontal and vertical)?
Thank you
No. It's a bit difficult too since the size of a console can vary, so there's no 100% guarantee that you can get it to center.
Your best shot is to rely on center formulas (ie console_height / 2 - text_height / 2).
Hi,
Thank you for your reply. Do i need to include any library to use the console_height and text_height. Also how can I combine the the result from this function to the printf statement to move it ?
Thank You
They are not variables. They are constants (YOU must figure them out, iow).
As for the how, I'd suggest looking at the printf documentation. It's all a matter of formatting flags (and several \ns).
ok thank you for pointing me in the right direction, i will work on that.