String input problems in curses

karl at haddock karl at haddock
Tue Sep 23 00:09:00 AEST 1986


csustan!guest (Chris Rhodes) writes:
>while designing a particular application using curses, the UNIX
>terminal control package, I have found that *none* of the string
>input functions work - not gets, scanf, or wscanw or any of the
>other curses input routines.
>I ended up having to do a "while ( (c = getchar()) != '\n');"
>structure which works, but I fear that I may be doing something
>wrong which may cause other mysterious bugs.

I don't know if it's the same on 4.2bsd, but in SysV curses it isn't really
safe to use stdio directly -- you should use the curses getch() function
instead of getchar().  But you say wscanw() etc. are also failing?

Assuming it isn't a curses bug (if so, you'd think someone else would have
found it by now -- it looks pretty serious!), I'd guess that you've used an
identifier that accidentally collides with a global identifier from the
library.  (I had a similar problem with a program that had a global variable
named "time".)  Try using lint, if you have a decent lint library for curses.

>Most of these give me a "Bus error (core dumped)" message (one which I have
>generally gotten sick of)

Have you considered examining the core dump?  That's what it's for!

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list