LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-18-2003, 08:17 AM   #1
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
Question Colors in NCurses


In the name of God
Hi all,
I can not change color in the screen using NCurses. There are some functions for this mean, none of them change color : attrset, initpair, start_color,....
Help please/
 
Old 03-18-2003, 09:17 AM   #2
sidey
Member
 
Registered: Mar 2003
Location: Essex UK
Distribution: rh 8.0 bsd 5.0 slack 9.0 rc2 crux
Posts: 147

Rep: Reputation: 15
#include <ncurses.h>
int main() {

initscr();
noecho();
crbreak();
start_color();
init_pair(1, COLOR_RED, COLOR_BLACK);

attron(COLOR_PAIR(1));
printw("Hey,i'm in colour");
attroff(COLOR_PAIR(1));
getch();
endwin();
}

any more help needed try

http://www.linuxselfhelp.com/HOWTO/N...WTO/color.html

Last edited by sidey; 03-18-2003 at 09:19 AM.
 
Old 03-18-2003, 06:19 PM   #3
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
just a correction....

line 6 :
crbreak();

should be :
cbreak();


Other than that it works...
 
Old 03-19-2003, 06:19 AM   #4
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Original Poster
Rep: Reputation: 30
Thanks.
I'll check, BTW what does cbreak do?
I have an NCurses manual (about 200kb HTML) but it has very few discriptions, is any more compelete manual available on the net?
 
Old 03-19-2003, 11:20 PM   #5
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Original Poster
Rep: Reputation: 30
Angry

?
 
Old 03-20-2003, 05:10 AM   #6
sidey
Member
 
Registered: Mar 2003
Location: Essex UK
Distribution: rh 8.0 bsd 5.0 slack 9.0 rc2 crux
Posts: 147

Rep: Reputation: 15
from the howto i posted in the first post.....

4.2. raw() and cbreak()
Normally the terminal driver buffers the characters a user types until a new line or carriage return is encountered. But most programs require that the characters be available as soon as the user types them. The above two functions are used to disable line buffering. The difference between these two functions is in the way control characters like suspend (CTRL-Z), interrupt and quit (CTRL-C) are passed to the program. In the raw() mode these characters are directly passed to the program without generating a signal. In the cbreak() mode these control characters are interpreted as any other character by the terminal driver. I personally prefer to use raw() as I can exercise greater control over what the user does.

 
Old 03-20-2003, 07:07 AM   #7
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Original Poster
Rep: Reputation: 30
Thancks Sidey,
Where is this Howto?
 
Old 03-20-2003, 08:40 AM   #8
sidey
Member
 
Registered: Mar 2003
Location: Essex UK
Distribution: rh 8.0 bsd 5.0 slack 9.0 rc2 crux
Posts: 147

Rep: Reputation: 15
its at the start of the thread but here again just in case


http://www.linuxselfhelp.com/HOWTO/...OWTO/color.html
 
  


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
NCurses Mohsen Programming 7 10-07-2006 10:53 AM
no ncurses? oracleofmist Linux - Software 2 09-22-2004 07:56 PM
ncurses with RH 8 ? marudhu Programming 6 07-23-2003 03:52 PM
Ncurses Cruelpeace Programming 1 01-30-2003 07:21 PM
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 02:21 AM.

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