[comp.lang.c] Curses Problem

drezac@dcscg1.UUCP (Duane L. Rezac) (11/09/89)

HELP!!!


I am trying to use the curses package in a c program, and I can not determine
what my problem is. When I compile the program and run it, nothing happens 
(i.e. no screen activity), but if I run it using dbx, the curses routines 
work!. Any Ideas on what's wrong?  (We do not have any curses manuals, only
a very weak man page. )

I am compiling with : cc -o test test.c -g -lcurses -ltermcap
our system is runing UTX 2.0 (4.3 BSD)




#include <stdio.h>
#include <curses.h>

main()
{
  WINDOW *win;
  initscr(); 
  win=newwin(10,10,10,10);
  box(win,'+','+');
  wprintw(win,"this is a test");
  wrefresh(win);
  endwin();
  exit(0);
  };

Thanks for any help


-- 
+-----------------------+---------------------------------------------------+
| Duane L. Rezac |These views are my own, and NOT representitive of my place|
| dsacg1!dcscg1!drezac    drezac@dcscg1.dcsc.dla.mil      of Employment.    |
+-----------------------+---------------------------------------------------+

drezac@dcscg1.UUCP (Duane L. Rezac) (11/10/89)

From article <617@dcscg1.UUCP>, by drezac@dcscg1.UUCP (Duane L. Rezac):
> HELP!!!
> 
> 
> I am trying to use the curses package in a c program, and I can not determine
> what my problem is. When I compile the program and run it, nothing happens 
> (i.e. no screen activity), but if I run it using dbx, the curses routines 
> work!. Any Ideas on what's wrong?  (We do not have any curses manuals, only
> a very weak man page. )

I have some additional info on this problem. I tried to run the program on
one of our other systems, and everything ran fine!  so it looks like it is 
something specifict to this individual machine.

(if I had known that, I would have held off on the original post-Sorry!)


-- 
+-----------------------+---------------------------------------------------+
| Duane L. Rezac |These views are my own, and NOT representitive of my place|
| dsacg1!dcscg1!drezac    drezac@dcscg1.dcsc.dla.mil      of Employment.    |
+-----------------------+---------------------------------------------------+

john@chinet.chi.il.us (John Mundt) (11/10/89)

In article <617@dcscg1.UUCP> drezac@dcscg1.UUCP (Duane L. Rezac) writes:
>HELP!!!
>
>
>I am trying to use the curses package in a c program, and I can not determine
>what my problem is. 
>main()
>{
>  WINDOW *win;
>  initscr(); 
>  win=newwin(10,10,10,10);
>  box(win,'+','+');
>  wprintw(win,"this is a test");
>  wrefresh(win);
>  endwin();
>  exit(0);
>};


You have not specifically placed the cursor before you issued
the wprint statment.  That could leave the cursor location at
a spot outside of the window, in which case the print statement
won't execute (at least in my version it quietly fails if asked
to print outside of the legal boundaries.  

You should do one of the following:

	wmove(win, 0,0);
	wprintw(win, "this is a test");

or

	mvwprintw(win, 0, 0, "this is at test");

Either will work.
-- 
---------------------
John Mundt   Teachers' Aide, Inc.  P.O. Box 1666  Highland Park, IL
john@chinet.chi.il.us
(312) 998-5007 (Day voice) || -432-8860 (Answer Mach) && -432-5386 Modem