ncurses - creating an array of windows

Hi all,

I hope someone here has enough exprience in ncruses to answer my question.

I have defined in my ncruses based program several window variables as follows:

1
2
3
4
5
6
7
8
9
10
WINDOW *a0, *b0, *c0, *d0, *e0, *f0, *g0, *h0, *i0;
WINDOW *a1, *b1, *c1, *d1, *e1, *f1, *g1, *h1, *i1;
WINDOW *a2, *b2, *c2, *d2, *e2, *f2, *g2, *h2, *i2;
WINDOW *a3, *b3, *c3, *d3, *e3, *f3, *g3, *h3, *i3;
WINDOW *a4, *b4, *c4, *d4, *e4, *f4, *g4, *h4, *i4;
WINDOW *a5, *b5, *c5, *d5, *e5, *f5, *g5, *h5, *i5;
WINDOW *a6, *b6, *c6, *d6, *e6, *f6, *g6, *h6, *i6;
WINDOW *a7, *b7, *c7, *d7, *e7, *f7, *g7, *h7, *i7;
WINDOW *a8, *b8, *c8, *d8, *e8, *f8, *g8, *h8, *i8;
WINDOW *a9, *b9, *c9, *d9, *e9, *f9, *g9, *h9, *i9;


Its rather long so I stopped here at 9, but in fact it goes to 26. Anyway, this kind of "brute force" approach takes time and is not very scalable.

Is there a way to define all these windows in a simple "for" loop ?

Something like:

1
2
for (x=0; x<27; x++){
...some code here that does the above work...


Furthermore, once all these window variables are defined, I wanted to stock them into an array and it doesn't seem to work, the program fails when I place the following code:

 
WINDOW array_win[]={*a0, *b0, *c0, *d0....}


Thanks for your help,

Wissam

Last edited on
Declare an array of pointers to WINDOW ( WINDOW *array_win[26]; )
Topic archived. No new replies allowed.