Setting stdout/stderr text color in Windows

后端 未结 3 1710
猫巷女王i
猫巷女王i 2020-12-11 05:03

I tried using system(\"color 24\"); but that didn\'t change the color in the prompt. So after more Googling I saw SetConsoleTextAttribute and wrote

3条回答
  •  既然无缘
    2020-12-11 05:26

    Try to set the color before each output. You can do that in a function to avoid code duplication.

提交回复
热议问题