LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-11-2010, 08:37 PM   #1
youngstorm
Member
 
Registered: May 2003
Location: USA
Distribution: Fedora 21, RHEL 5,6&7, Windoze 7
Posts: 235

Rep: Reputation: 31
ncurses does not blink


Hi,
I am trying to learn ncurses programming with "Programmer's guide to ncurses". Everything seems to work right till I try to make text blink. I get no errors or warnings. Here is my compile command "cc -Wall -lncurses -o twinkle twinkle.c" I am using fedora 12. 'env' shows that TERM=linux. What am I doing wrong?

thank you

#### Code ####
#include <ncurses.h>

int main(void)
{
initscr();

attron(A_BOLD);
addstr("Twinkle, twinkle little star\n");
attron(A_BLINK);
addstr("How I wonder what you are.\n");
attroff(A_BOLD);
addstr("Up above the world so high,\n");
addstr("Like a diamond in the sky.\n");
attrset(A_NORMAL);
addstr("Twinkle, twinkle little star\n");
addstr("How I wonder what you are.\n");
refresh();

endwin();

return 0;
}

Last edited by youngstorm; 04-11-2010 at 08:40 PM.
 
Old 04-12-2010, 09:30 PM   #2
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
If I change TERM to linux and run this program in konsole on Slackware 13.0, then three lines of text blink.

If I run this program at the Linux console, then those same three lines of text have a gray background color, and they do not blink.

If I pipe to "hexdump -C" then I get the following output.

Code:
00000000  1b 5b 31 3b 32 38 72 1b  5b 30 3b 31 30 6d 1b 5b  |.[1;28r.[0;10m.[|
00000010  34 6c 1b 5b 3f 37 68 1b  5b 48 1b 5b 4a 1b 5b 30  |4l.[?7h.[H.[J.[0|
00000020  3b 31 30 3b 31 6d 54 77  69 6e 6b 6c 65 2c 20 74  |;10;1mTwinkle, t|
00000030  77 69 6e 6b 6c 65 20 6c  69 74 74 6c 65 20 73 74  |winkle little st|
00000040  61 72 0d 0a 1b 5b 30 3b  31 30 3b 35 3b 31 6d 48  |ar...[0;10;5;1mH|
00000050  6f 77 20 49 20 77 6f 6e  64 65 72 20 77 68 61 74  |ow I wonder what|
00000060  20 79 6f 75 20 61 72 65  2e 0d 0a 1b 5b 30 3b 31  | you are....[0;1|
00000070  30 3b 35 6d 55 70 20 61  62 6f 76 65 20 74 68 65  |0;5mUp above the|
00000080  20 77 6f 72 6c 64 20 73  6f 20 68 69 67 68 2c 0d  | world so high,.|
00000090  0a 4c 69 6b 65 20 61 20  64 69 61 6d 6f 6e 64 20  |.Like a diamond |
000000a0  69 6e 20 74 68 65 20 73  6b 79 2e 0d 0a 1b 5b 30  |in the sky....[0|
000000b0  3b 31 30 6d 54 77 69 6e  6b 6c 65 2c 20 74 77 69  |;10mTwinkle, twi|
000000c0  6e 6b 6c 65 20 6c 69 74  74 6c 65 20 73 74 61 72  |nkle little star|
000000d0  0d 0a 48 6f 77 20 49 20  77 6f 6e 64 65 72 20 77  |..How I wonder w|
000000e0  68 61 74 20 79 6f 75 20  61 72 65 2e 0d 0a 1b 5b  |hat you are....[|
000000f0  32 38 3b 31 48 0d                                 |28;1H.|
000000f6
The first blinking line is "How I wonder what you are." It begins with the following escape code.

ESC[0;10;5;1m

Code:
param   result
0       reset all attributes to their defaults
1       set bold
5       set blink
10      reset  selected mapping, display control flag, and toggle meta flag (ECMA-48 says "primary font").
According to console_codes(4), the line ought to boldly blink. I found the above table in the section titled "ECMA-48 Set Graphics Rendition." It says "Several attributes can be set in the same sequence, separated by semicolons."

libncurses, foiled again..
 
Old 04-19-2010, 09:39 PM   #3
youngstorm
Member
 
Registered: May 2003
Location: USA
Distribution: Fedora 21, RHEL 5,6&7, Windoze 7
Posts: 235

Original Poster
Rep: Reputation: 31
hello BenCollver2,
Thank you for your reply. I was no fimiliar with hexdump. I tryed "hexdump -C" in fedora 12 but I do not see the ESC[0;10;5;1m anywhere or anything resembling it. I would have assumed it would be in there. Also, how do you know that "ECMA-48" is the correct section? I had no idea.


thanks again,
Mike
 
Old 04-19-2010, 10:18 PM   #4
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
What output do you get from this command? ./twinkle | hexdump -C

Here are the relevant excerpts from my output. The hexadecimal values "1b 5b 30 3b 31 30 3b 35 3b 31 6d" and the ASCII representation ".[0;10;5;1m".

I know that hexadecimal 1b is the same as ESC or the escape character. I did not know about ECMA-48 until I skimmed through the manual and found something that my output resembled.
 
Old 04-20-2010, 05:15 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
it's probably more to do with your terminal setup than your program,
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to print text in color by ncurses without opening a ncurses window Greatrebel Programming 0 12-20-2006 09:15 AM
Direct Rendering : Yes - FPS: blink, blink, blink... giz2z Linux - Software 1 12-14-2006 01:54 AM
Post-install: machine won't boot w/ Vector ...blink blink blink goes the cursor nethbar VectorLinux 3 03-17-2004 02:32 PM
Is a symlink suppose to blink? angmaya Linux - Newbie 5 10-18-2003 12:12 AM
ncurses-5.2-28 conflicts with file from package ncurses-5.2-12 tubby Linux - Software 4 06-16-2002 12:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration