How strongly are ncurses incompatible with signals?

S

sirix

Hi,
I'm using g++ 4.1.2 and ncurses 5.6.

Following simple code correctly displays dimensions of an xterm while one
resizes it's window. I thought that uncommenting wouldn't change anything
in a behaviour of this program. However, it does change - on execution
program correctly displays xterm dimensions, but after changing size of a
window it still shows old dimensions.

What should I think about it?

---
#include <ncurses.h>
#include <iostream.h>
#include <signal.h>
void handler(int sig){};

main() {
// signal(SIGWINCH,handler);
initscr();
int X,Y;
char msg[10];
for(;;){
getmaxyx(stdscr,Y,X);
clear();
sprintf(msg,"%d, %d",X,Y);
addstr(msg);
refresh();
usleep(400);
}
}

---
 
B

BobR

sirix said:
Hi,
I'm using g++ 4.1.2 and ncurses 5.6.

Following simple code correctly displays dimensions of an xterm while one
resizes it's window. I thought that uncommenting wouldn't change anything
in a behaviour of this program. However, it does change - on execution
program correctly displays xterm dimensions, but after changing size of a
window it still shows old dimensions.

What should I think about it?

---
#include <ncurses.h>
#include <iostream.h>
#include <signal.h>
void handler(int sig){};

main() {
// signal(SIGWINCH,handler);
initscr();
int X,Y;
char msg[10];
for(;;){
getmaxyx(stdscr,Y,X);
clear();
sprintf(msg,"%d, %d",X,Y);
addstr(msg);
refresh();
usleep(400);
}

// ???
getmaxyx(stdscr,Y,X);
sprintf(msg,"%d, %d",X,Y);

You should think, "Oh my gosh, how does something that does NOT exist in C++
work?".

// > #include <iostream.h>
#include <iostream>
// > main() {
int main(){} // ALWAYS!!

Then think, "I should check the FAQ for this group to see if 'ncurses' is
on-topic!".

FAQ http://www.parashift.com/c++-faq-lite

Then think, "That BadBob is sure a jerk!".

Hey, I resemble that remark!! <G>

Might check the docs for 'ncurses'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,049
Members
47,655
Latest member
eizareri

Latest Threads

Top