【发布时间】:2012-02-08 23:45:09
【问题描述】:
我知道“textcolor();”是用于 C++ 的,我已经看到了 unix 的方法...... 但是windows也有办法吗?
#include <stdio.h>
int main()
{
printf("\ntest - C programming text color!");
printf("\n--------------------------------");
printf("\n\n\t\t-BREAK-\n\n");
textcolor(15);
printf("WHITE\n");
textcolor(0);
printf("BLACK\n");
textcolor(4);
printf("RED\n");
textcolor(1);
printf("BLUE\n");
textcolor(2);
printf("GREEN\n");
textcolor(5);
printf("MAGENTA\n");
textcolor(14);
printf("YELLOW\n");
textcolor(3);
printf("CYAN\n");
textcolor(7);
printf("LIGHT GRAY\n");
}
我在网上找不到任何东西... 让我们希望堆栈溢出的好人可以提供帮助:D
请使用 C,而不是 C++
【问题讨论】:
-
我在 Windows 上的
git bash和MSYS2上都使用 ANSI 转义码,效果很好。
标签: c windows cmd command-prompt textcolor