rsk82
rsk82

Reputation: 29387

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 ?

Upvotes: 3

Views: 1198

Answers (2)

Jerry Coffin
Jerry Coffin

Reputation: 490138

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.

Upvotes: 3

Cole Tobin
Cole Tobin

Reputation: 9430

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...

Upvotes: 1

Related Questions