Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to color one given line in console without writing text to it?

Normally this is done by SetConsoleTextAttribute() and then writting text. But it is possible to change line colors after text has been written to the line ?

like image 240
rsk82 Avatar asked Dec 02 '25 14:12

rsk82


2 Answers

At least if memory serves, WriteConsoleOutputAttribute can do that.

Edit: ...or, if you want a block all set to the same attribute, you can use FillConsoleOutputAttribute.

like image 112
Jerry Coffin Avatar answered Dec 04 '25 02:12

Jerry Coffin


No, but you can set the cursor back up to that line, change color, rewrite the text, then jump back to where the cursor was before the jump to rewrite.

I'm not an expert c++ programmer (despite wearing my "Hello World!" t shirt today ☺), so I can't give you any help...

like image 24
Cole Tobin Avatar answered Dec 04 '25 03:12

Cole Tobin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!