彩色控制台在ANSI C? [英] Color console in ANSI C?
问题描述
是否可以使用简单的ANSI C对控制台输出进行着色?没有外部库?这可以在Windows,Linux或Mac OS X中完成吗?
Is it possible to color the console output in just plain ANSI C? Without an external library? Can this be done in Windows, Linux, or Mac OS X?
推荐答案
?
just plain ANSI C?
否。 C标准不假定stdout是控制台或有颜色。
No. The C standard doesn't assume the stdout is a console or has color.
可以在Windows,Linux或Mac操作系统X?
Can this be done in Windows, Linux, or Mac OS X?
是的。请参阅 如何以跨平台方式在Mac OS X上以彩色打印到控制台? 适用于Linux和Mac OS X。
Yes. See How can I print to the console in color on Mac OS X in a cross-platform manner? for Linux and Mac OS X.
对于Windows,您可能需要直接访问控制台功能,如果您想避免外部库。
For Windows, you may need to directly access the Console Functions if you want to avoid external libraries.
这篇关于彩色控制台在ANSI C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!