Re: Is there a getch()?

From: Gargamel (malice@epix.net)
Date: 02/07/96


On Wed, 7 Feb 1996, Jeremy Elson wrote:

> Date: Wed, 07 Feb 96 22:32:29 EST
> From: Jeremy Elson <jelson@blaze.cs.jhu.edu>
> To: Sammy <samedi@clark.net>
> Cc: root <root@crossfire.1234net.com>, circle@pvv.unit.no,
>     jelson@pvv.unit.no
> Subject: Re: Is there a getch()? 
> 
> 
> > > This is more of a general c question I think.  I want someone to be able 
> > > to type in a letter and have my code react immediately (not after they 
> > > press enter).  All of the ansi c books I have say to use getch().  I 
> > > don't have getch().  It is supposed to be in stdio.h or conio.h.  I don't 
> > > have a conio.h and it isn't in stdio.h.  I am running linux(bunch of 
> > > different versions) with gnu c 2.6.3.  Is there another name for getch()?
> > 
> > The character-grabber in C I'm familiar with is getc(), but it polls 
> > standard input, not a socket.
> > 
> > If you look deep into the socket-handling routines in circle, you may 
> > find an input buffer.  If you can find this (I'm not sure if it exists in 
> > circle, I'm just guessing it works this way), and learn how it works, you 
> > can check the buffer before it gets passed to the command interpreter, 
> > and just check for the oldest character (the one that was entered first 
> > since the last buffer purge).
> 
> getc() and getch() should be in most standard C implementations; the problem
> is not finding the right function but the fact that telnet clients are
> usually in line mode when they connect to Circle (i.e. the 'telnet' program
> only sends a complete line to Circle after the carriage-return, so getc()
> and getch() will be useless).
> 
> You could tell 'telnet' to go to character mode if you really wanted to,
> but I *strongly* recommend not doing that because it will drastically
> increase the amount of network traffic.

If I wanted to design a new editor for circle that looks or acts like pico
or vi and use this type character mode format...how would I go about 
turning it on? and turning line by line mode back on when I am done
with character mode? Ie: what are the exact commands to send to the telnet
client? I have been toying with the idea of putting a pico type editor 
for OLC and writing board messages and such into circlemud for a while now..
Any help would be appriciated...


|\      /|
| \    / |
|  \  /  |
|   \/   |
|        |
|        | alice@epix.net
           Enough Said...



This archive was generated by hypermail 2b30 : 12/07/00 PST