是否可以在Linux中使用C ++在控制台应用程序中闪烁文本? [英] Is it possible to have blinking texts in Console application in linux using C++?

查看:86
本文介绍了是否可以在Linux中使用C ++在控制台应用程序中闪烁文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了让我们的CUI在使用C ++的linux环境中看起来更生动,我们可以使用闪烁的文本吗?



提前谢谢!!!

Can we have blinking texts in order to make our CUI look more lively in linux environment using C++?

Thanks in advance!!!

推荐答案

对于控制台功能来说,这比编程语言更加困难。



到目前为止控制台是ANSI兼容,可以使用以下代码:



It is much more a problem relatd to the console capability than to the programming language.

As far the console is ANSI compatible, the following code can be used:

<esc>[{attr1};...;{attrn}m

0	Reset all attributes
1	Bright
2	Dim
4	Underscore	
5	Blink
7	Reverse
8	Hidden

	Foreground Colours
30	Black
31	Red
32	Green
33	Yellow
34	Blue
35	Magenta
36	Cyan
37	White

	Background Colours
40	Black
41	Red
42	Green
43	Yellow
44	Blue
45	Magenta
46	Cyan
47	White





因此,眨眼可以通过
$ b $获得b



So, blinking can be obtained by

cout << "\x1b[5m" << "TEXT" << "\x1b[0m" 


这篇关于是否可以在Linux中使用C ++在控制台应用程序中闪烁文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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