jadam@cs.tamu.edu (James P Adam) (03/26/91)
I'm working on a DOS machine, and I'm trying to use the C++ streams library of stuff to read control-characters from the keyboard. What I'd like to be able to do, for instance, is to ask for some input (an integer, say) and be able to abort the request if the first character hit is the ESCAPE key. The problem is that characters like ESCAPE, CTRL-S, CTRL-P, CTRL-Z, etc., never get through to my program if I use cin. What I used to do, back in plain C, was to use machine-specific get()-type functions that read keystrokes from the BIOS without echoing them, and without letting them go through the operating system. I could still do this, but if I'm going to link in the streams library, I'd like avoid having to link in other input-output routines if at all possible. Especially in short programs, the overhead of all these library routines starts to get pretty heavy. I tried to do something like: istream_withassign noEcho = cin; but the compiler complained, even though cin is supposed to be of class istream_withassign. A general question that relates to this matter: Are there any reference books available for the streams library? The books I've seen cover the library in one chapter, if you're lucky, and they rarely go beyond talking about cin/cout/cerr. According to Borland, the streams library consists of more than a hundred classes; it'd be kinda nice to know something about some of those classes && be able to use them. Jim
jim@se-sd.SanDiego.NCR.COM (Jim Ruehlin, CFC User) (03/29/91)
In <13731@helios.TAMU.EDU> jadam@cs.tamu.edu (James P Adam) writes: > I'm working on a DOS machine, and I'm trying to use the C++ streams >library of stuff to read control-characters from the keyboard. What I'd >like to be able to do, for instance, is to ask for some input (an >integer, say) and be able to abort the request if the first character >hit is the ESCAPE key. > The problem is that characters like ESCAPE, CTRL-S, CTRL-P, CTRL-Z, >etc., never get through to my program if I use cin. > What I used to do, back in plain C, was to use machine-specific I've used streams mostly for file IO, not keyboard. But I know if I have to do binary IO I need to use the read() and write() methods. You may want to try these, or the get() and put() methods. It works for me! - jim ruehlin