Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Can we have blinking texts in order to make our CUI look more lively in linux environment using C++?

Thanks in advance!!!
Posted
Comments
PIEBALDconsult 30-Nov-14 13:12pm    
I expect that has more to do with the video card than the Operating System and language.

1 solution

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


So, blinking can be obtained by

cout << "\x1b[5m" << "TEXT" << "\x1b[0m" 
 
Share this answer
 
v3
Comments
Zoltán Zörgő 30-Nov-14 15:33pm    
Good old ANSI codes... :) My 5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900