How can I change the text color in the windows command prompt

后端 未结 14 2665
南旧
南旧 2020-12-14 22:32

I have a command line program, which outputs logging to the screen.

I want error lines to show up in red. Is there some special character codes I can output to switc

14条回答
  •  臣服心动
    2020-12-14 22:57

    Ultimately you need to call SetConsoleTextAttribute. You can get a console screen buffer handle from GetStdHandle.

提交回复
热议问题