By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,399 Members | 1,303 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,399 IT Pros & Developers. It's quick & easy.

How strongly are ncurses incompatible with signals?

P: n/a
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);
}
}

---

Aug 31 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
sirix wrote:
Hi,
I'm using g++ 4.1.2 and ncurses 5.6.
Best to ask on comp.unix.programmer.

--
Ian Collins.
Aug 31 '07 #2

P: n/a
Ian Collins (Sat, 01 Sep 2007 11:19:08 +1200):
sirix wrote:
>Hi,
I'm using g++ 4.1.2 and ncurses 5.6.
Best to ask on comp.unix.programmer.
Thanks.
Aug 31 '07 #3

P: n/a

sirix <si***@poczta.onet.plwrote in message...
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'.

--
Bob R
POVrookie
Sep 1 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.