public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Erik Mouw <J.A.K.Mouw@its.tudelft.nl>
To: nuklear@singnet.com.sg
Cc: gcc@gcc.gnu.org
Subject: Re: Newbie:getch??
Date: Sun, 20 Feb 2000 10:07:00 -0000	[thread overview]
Message-ID: <200002201807.TAA27094@duteinh.et.tudelft.nl> (raw)
In-Reply-To: <38B00E12.2C8022B5@singnet.com.sg>

On Sun, 20 Feb 2000 15:53:54 +0000, Joachim wrote:
> I'm very new with gcc so please forgive me my stupid question!
> 
> I was wondering if there would be a function available that reads only
> one character from stdin.
> To be more specific I need something that works the same way as:
> kbhit() or...
> getch() or...
> getche() alias Borlands <conio.h>
> 
> I need it to write an input function to handle my own keyboard
> definitions. 
> Unfortunatly getchar() is unsuitablee for what I want to do. 
> Any glues on what to use?

First of all, this is not the correct mailing list. This list about the
development of gcc, not the development with gcc. If you're working on
Linux, consider joining the Linux-C-Programming mailinglist:

  http://mail.i-docs.org/mailman/listinfo/linuxcprogramming

To answer your question: all functions in conio.h are DOS specific (as the
Borland manuals will point out). Your problem is that you are using the
stdin FILE pointer which is buffered, so all read functions won't return
until the complete line is read. Make it unbuffered (man setbuf). You can
also use the S-Lang library, which makes it as simple as using the
function SLang_getkey(). The book "Linux Application Development" by
Michael K. Johnson and Erik W. Troan has a complete chapter about S-Lang.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/



  reply	other threads:[~2000-02-20 10:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-20  7:52 Newbie:getch?? Joachim
2000-02-20 10:07 ` Erik Mouw [this message]
2000-03-16  7:45 Newbie:getch?? Jose Camargo
2000-03-16 10:17 ` Newbie:getch?? Mo McKinlay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200002201807.TAA27094@duteinh.et.tudelft.nl \
    --to=j.a.k.mouw@its.tudelft.nl \
    --cc=gcc@gcc.gnu.org \
    --cc=nuklear@singnet.com.sg \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).