[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 729
  • Last Modified:

UNIX C equiv. for conio.h

I'm trying to port my DOS code over to UNIX but the only catch is UNIX doesn't have conio.h...specifically kbhit ()
I need a way to just detect 1 char in the buffer...I'm using read (...) but it doesn't seem to work. Any leads?
0
dpeng
Asked:
dpeng
1 Solution
 
ksatoCommented:
Wouldn't using getch() work to read off the keyboard and storing it in a buffer.  When getch() returns can't you assume something fresh is in the buffer to be read?
0
 
Jackie071497Commented:
The getch() is only supported by DOS & OS/2.
Under Unix, you can use the getchar() like this :
#include <stdio.h>
main()
{
int ch;
ch = getchar();
}

0
 
ozoCommented:
There is a getch() in unix, under
#include <curses.h>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now