ANSI C 中的颜色控制台? [英] Color console in ANSI C?

查看:21
本文介绍了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?

推荐答案

只是普通的 ANSI C?

just plain ANSI C?

没有.C 标准不假定标准输出是控制台或有颜色.

No. The C standard doesn't assume the stdout is a console or has color.

这可以在 Windows、Linux 或 Mac OS 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,您可能需要直接访问 Console Functions 如果您想避免使用外部库.

For Windows, you may need to directly access the Console Functions if you want to avoid external libraries.

这篇关于ANSI C 中的颜色控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆