kasdan@cunixd.cc.columbia.edu (John Kasdan) (10/27/89)
I have been trying to write an encryption program which accepts an integer as a key. It seemed like a good idea to turn off echoing while the key is entered, so I decided to use curses. The problem is, I don't seem to be able to enter an integer from the keyboard in any reasonable way. scanf behaves badly on non-numeric data, and even worse on integers bigger than the maximum size allowed. So I thought I would use getch() to put the input into a buffer and then use sscanf. The trouble is, getch() doesn't give any indication of the end of the input. No \n or \0 or EOF. Nothing. getc() does, but it doesn't work with curses. The system I'm working on is VMS C. Is this problem unique to that environment? I could, of course, use DCL to turn off echoing, but I was trying for a little more portability. The tentative solution I'm using is getstr() and, to avoid the Robert Morris problems, buffers the size of MAXBUF, the largest allowable line, which is 2K. Pretty ugly. Anyone know a better way? _________________ /KAS John Kasdan internet: kasdan@cunixd.cc.columbia.edu Columbia University, bitnet: kasdan@cunixC.cc.columbia.edu School of Law uucp: 435 West 116th St. {rutgers,seismo,topaz}!columbia!cunixd!kasdan New York, NY 10027 _________________ "Life is like an analogy", anonymous project leader.