[net.lang.c] Curses HELP! Wanted

dont@tekig1.UUCP (Don Taylor) (01/08/85)

X
     Could some generous person mail me a short note explaining what it is that
I am doing wrong.  I wrote a short program using curses, using another as an
example.  The example failed to do any input, but curses provides scanw(),
getstr(),  etc, so that should be no problem.  It seems that nothing I try will
make either work.  In desparation, I put an ordinary scanf() in place of the
scanw() and, except for moving the cursor without curses knowledge and messing
up a corner of the screen, it worked fine.  Scanw() on the other hand seems to
find almost anything other than what scanf() was perfectly happy to find.  The
manual claims 'scanw()    scanf through the standard screen', seems simple
enough for anyone.  The scanf() and scanw() use is identical.  The only calls
used are initscr(), clear(), standout(), mvprintw(), standend(), and refresh().
It's berkley 4.2, if it matters.
Thanks for any assistance.
Don Taylor
tektronix!tekig1!dont

arnold@ucsfcgl.UUCP (Ken Arnold%CGL) (01/09/85)

In article <1815@tekig1.UUCP> dont@tekig1.UUCP (Don Taylor) writes:
>X
>     Could some generous person mail me a short note explaining what it is that
>I am doing wrong....  It seems that nothing I try will make [scanw() or
>getstr()] work.

I'm posting this to the net to increase general knowledge of this and
to increase the amount of embarassment to the person who blew this,
namely me.

Berkeley 4.2 curses' scanw() and getstr() do not work for reasons I
never figured out, since I never used them and I didn't know anyone who
did, and nobody every paid me to do so.

I always handle the input myself, since no general routine can usually
handle the kind of input I'm trying to do.  I just turn off echo() and
turn on cbreak mode, and do my own echoing.  Unfortunately, I would
recommend that you do the same.  Personally, had I to do it over again,
I would just delete them all, and add some general routine that would
handle simple text echoing given some parameters as to maximum length
and terminating characters.

		Ken Arnold

sherouse@unc.UUCP (George W. Sherouse) (01/10/85)

I've written a little library of "crash-proof" datum-entry routines
which I might be persuaded to share.  The routines are things like

	int get_int(default, field_size);
	void get_string(string, field_size, boolean_null_ok);
	float get_float(default, field_size, fractional_part_size);

and so on.  Datum entry is supervised and can be made unescapable.
I have two versions - one which is curses-compatible and another
which talks to termcap itself.  Both are tested only for 4.2bsd.

Let me know if you would like a copy.  If requests reach a critical
mass I will post it to net.sources.  Please allow 6 weeks for delivery.

George W. Sherouse
Associate Physicist
Division of Radiation Therapy
North Carolina Memorial Hospital
Chapel Hill, NC   27514

(919) 966-1101

<decvax!mcnc!unc!godot!sherouse>

brad@bradley.UUCP (01/13/85)

I write my own input routines using 'wgetch' and output using waddch.

if that helps.
-brad