From: Kevin Ashley Newsgroups: comp.os.msdos.djgpp Subject: Re: Getch() in UNIX Date: Tue, 12 May 1998 17:30:49 +0100 Organization: Posted via ULCC Internet Services Lines: 30 Message-ID: <35587939.41C6@ulcc.ac.uk> References: <354EE6B2 DOT 41C6 AT cc DOT hut DOT fi> <35517F12 DOT 2ECAC739 AT cais DOT kaist DOT ac DOT kr> NNTP-Posting-Host: silver.ulcc.ac.uk 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 Dan, Ho-Jin wrote: > > #include > #include > > int getch() { > struct termio o, n; > char c; > > ioctl(0, TCGETA, &o); > ioctl(0, TCGETA, &n); .... A minor point, but one that helps portability - most systems that support the termio stuff indicate that the function-call interface is preferable to the ioctl interface. Use tcgetattr, tcsetattr in preference to ioctl. This has the obvious advantage that it is much easier to re-implement a function like tcsetattr on another system that doesn't have termio done in the device driver than it is to hack ioctl to support extra attributes. ------------------------------------------------------------------------------ Kevin Ashley K DOT Ashley AT Ulcc DOT ac DOT uk Special Projects Manager http://www.ulcc.ac.uk/staff/Kevin+Ashley ULCC ...ukc!ncdlab!K.Ashley (but probably not any more) This is not a signature