Why does this fail? [repost]
John Davis
chem194 at csc.canterbury.ac.nz
Mon Jun 24 08:47:05 AEST 1991
In article <1991Jun21.143411.21416 at siia.mv.com>, drd at siia.mv.com (David Dick) writes:
> The program at the end of this posting produces the following
> output when run on the three machines given:
>
> RESULTS--
>
> ARIX (Motorola 68020):
>
> inch returned 'X' (0x58)
>
> IBM RS/6000:
>
> inch returned '' (0x0)
>
> PROGRAM--
>
> /* intst -- simple inch() test */
>
> #include <curses.h>
> #include <stdio.h>
>
> main()
> {
> int ch;
>
> initscr();
> move(10,10);
> addch('X');
> move(10,10);
> ch = inch();
> endwin();
> printf("inch returned '%c' (0x%0x)\n",ch,ch);
> }
Welcome to the club - I just found that one too. As far as I
can see, stdscr->_y is not being initialised properly (in fact
it's nil), resulting in inch() (which derefs _y) grabbing
random chars. If you're real lucky you'll segmentation violation!!!
-----------------------------------------------------------
| o John Davis - CHEM194 at csc.canterbury.ac.nz o |
| o (Depart)mental Programmer,Chemistry Department o |
| o University of Canterbury, Christchurch, New Zealand o |
More information about the Comp.unix.aix
mailing list