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

查看:151
本文介绍了在ANSI C颜色控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能颜色只是普通的ANSI C控制台输出?如果没有外部库?可这在Windows,Linux或Mac OS X做?


解决方案

  

只是普通的ANSI C?


没有。 C标准并不承担stdout是一个控制台,或有颜色。


  

能否请在Windows,Linux或Mac OS X做?


是的。见<一href=\"http://stackoverflow.com/questions/2353430/how-can-i-print-to-the-console-in-color-on-mac-os-x-in-a-cross-platform-manner\">How我可以打印到Mac OS X上的颜色控制台在一个跨平台的方式?的为Linux和Mac OS X。

对于Windows,您可能需要直接访问控制台功能如果你想避免外部库。

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?

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

Can this be done in Windows, Linux, or 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.

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

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

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