Topic: Needing getch()... where is it?
Author: bwh@beach.cis.ufl.edu (Brian Hook)
Date: 04 May 1994 09:57:15 GMT Raw View
conio.h and getch() are both Borland/DOS specific function calls. You
shouldn't be able to find conio.h on the net (at least Borland's) since
it's Borland copyrighted. "The C++ book that [you] have" is DOS/Borland
specific -- try picking out something a bit more portable if you're working
with GCC or other non-DOS-oriented compilers.
Brian
PS Hint: There is no portable way of setting your system up to
automagically do unbuffered FILE oriented input. See latest C++ Report for
hacks around this, or old threads on comp.lang.c++, or maybe FAQ in
comp.lang.c.
--
+-----------------------------------------------------------------+
| Brian Hook | Specializing in real-time 3D graphics |
| Box 90315 |-----------------------------------------|
| Gainesville, FL 32607 | Internet: bwh@cis.ufl.edu | Free Tibet! |
+-----------------------------------------------------------------+
Author: doogie@iastate.edu (Matt Kelly)
Date: 4 May 94 07:13:16 GMT Raw View
Here's the deal: the system I'm on is has gcc version 2.4.5 and libg++
version 2.3.1. I'm writing a little program that needs getc() - described
by the C++ book that I have as a nonstandard function that provides unbuffered
input, with no echo of characters. According to the book, this function is
in conio.h. Unfortunately, our system doesn't seem to have this include file.
So the first question is: is there a standard function that performs the same
function? If not, is there some way to fake it using get()? (I've tried
using this approach without much success- it seems to hang on fooling the
buffer into thinking that it's received a carraige return after each character
is input, then sending a backspace to the screen, but I can't figure out how
to do that.) If there's no way to do that, then does anybody have a spare
copy of conio.h hanging around that they could send me a copy of? (I've tried
finding it on FTP sites, but due to disk quota limitations, I can't afford to
download the whole library, uncompress it, & pick out the file I need...) Any
help would be appreciated. Thanks in advance.
Matt
doogie@iastate.edu
Author: bkline%occs.nlm.nih.gov (Bob Kline)
Date: Thu, 5 May 94 14:22:37 GMT Raw View
Brian Hook (bwh@beach.cis.ufl.edu) wrote:
: conio.h and getch() are both Borland/DOS specific function calls. You
: shouldn't be able to find conio.h on the net (at least Borland's) since
: it's Borland copyrighted. "The C++ book that [you] have" is DOS/Borland
: specific -- try picking out something a bit more portable if you're working
: with GCC or other non-DOS-oriented compilers.
: Brian
: PS Hint: There is no portable way of setting your system up to
: automagically do unbuffered FILE oriented input. See latest C++ Report for
: hacks around this, or old threads on comp.lang.c++, or maybe FAQ in
: comp.lang.c.
Actually, I believe getch() originated with the curses package on UNIX
platforms (or at least its appearance there predates its appearance
in Borland's products). At any rate, it's much more portable than the
original response here would indicate (though conio.h is probably not
the right header -- more likely curses.h). If the linker isn't finding
the definition for getch() you need to tell gcc to look in the curses
library (something like -lcurses -- although the name might be different;
I don't have gcc on my system any more).
Just out of curiosity - why was this newsgroup chosen for a question
like this?
/*----------------------------------------------------------------------*/
/* Bob Kline CSI Technologies */
/* bkline@smtp.csof.com Corporate Software, Inc. */
/* voice: (703) 522-0820 fax: (703) 522-5407 */
/*----------------------------------------------------------------------*/