Strange curses problem

David Cook dcook at spam.ua.oz
Thu Jun 20 17:15:24 AEST 1991


Hello,
  here is a section of code I've been having trouble with,
in a program which uses curses.
(the problem is the same on SunOS 4.1.1/SPARC and OSx5.1/Pyramid 98xx,
using standard cc on both machines, ucb universe on the Pyramid -
the program works ok in att universe on the Pyramid )

The problem is, I am trying to display the array 'abroll' on the
screen, in a 6 row by 12 column format, evenly spaced.
The current behaviour is to print the first number in each column
in the correct place, and the other 5 appear around column 78 of the
same line as the first number . If I remove the commented out section 
of code, below, the program works.

 I have experimented with location and amount of
refresh(), but it seems to make no difference.
Could someone out there _please_ reduce my frustration, and
see the error that I'm missing (apart from the obvious one of
using curses in the first place :-) 

Also, I am seriously considering using termcap directly instead,
but I am not sure how to go about this, (I have RTFM, but I would
like some example code ), and would appreciate
some pointers in the right direction.

Thanks in advance,
     
  int l1,l2,abroll[12][6];

  initscr();
  crmode();
  nl();
  clear();

  for(l1=0;l1<12;l1++)
    for(l2=0;l2<6;l2++)
      {
	move(l2+6,l1*4+5);
        refresh();
        printw("%2d",abroll[l1][l2]);
	refresh();
/* when I include this commented out code, it works fine ... */
/*	move(23,1);
        refresh();
	printw(" debug : gxy(%d,%d) ",l1*4+4,l2+6);
	refresh();   */
	sleep(1);
     }

David T Cook | e-mail: dcook at spam.adelaide.edu.au | Phone: +61 8 228 5709
Assistant Computer Manager, Stats, Pure and Applied Maths LMG, Adelaide Uni
"The wonderful thing about USENET is that anyone can express their opinion."
"The worrying thing is that they _do_."



More information about the Comp.unix.programmer mailing list