From: gripinc AT hotmail DOT com (Neither) Newsgroups: comp.os.msdos.djgpp Subject: catching irregular keys Date: Mon, 16 Feb 1998 22:16:26 GMT Organization: The Evil Within Lines: 32 Message-ID: <34e8b9c6.16571480@n5.supernews.com> Reply-To: gripinc AT hotmail DOT com NNTP-Posting-Host: 15517 AT 208 DOT 0 DOT 232 DOT 186 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In this bit of code, the user can type as long as he wants until he/she types the '9' key. How can I make the program terminate on an 'alt-x' or 'F10', or anything besides a "regualr key". Thanks in advance to anyone who can help me. Here's the code: #include #include #include main() { //Declarations-- char avar,filename[12],phrase; int count; fstream ptr; //--------------- clrscr(); cout << "Filename? "; gets(filename); cout << "\nWhat information do you want in " << filename << " ?\n"; ptr.open(filename, ios::out); while ((phrase = getche()) != '9') { ptr << phrase; } ptr.close();