X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <40470F8C.AA25BECD@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: What is portable equivalent of getch()? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 22 Date: Thu, 04 Mar 2004 11:15:45 GMT NNTP-Posting-Host: 12.76.139.86 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1078398945 12.76.139.86 (Thu, 04 Mar 2004 11:15:45 GMT) NNTP-Posting-Date: Thu, 04 Mar 2004 11:15:45 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Anthony wrote: > > What construction should I use instead of getch() (just to wait > for keypress) to make code portable? You can wait for an ENTER (cr) keypress, with something like: int flushln(FILE *f) { int ch; while ((EOF != (ch = getc(f)) && ('\n' != ch)) continue; return ch; } /* flushln */ which is capable of detecting EOF. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net) Available for consulting/temporary embedded and systems. USE worldnet address!