I don't do people's homework for them but... Well there isn't a direct equivalent because in unix when you have a "terminal" session that generally means you have a "tty" devices as stdin/stdout/stderr. And, this tty device buffers input as well as things like generating signals to your process when CTRL-C is typed. You can get close though--you can use select() to determine if there's data to be read on stdin (which I'm guessing is what you want to do anyway). Here's a sample C program which demonstrates the technique.
Mario Olimpio de Menezes wrote: > Hi, > > I received a message from two students about the kbhit() C MSDOS > function equivalent in Linux. I'm not a good C programmer and could not > help them. If somebody can, please. > Thanks, and sorry for the little off-topic Debian. > > []s > Mario O.de Menezes "Many are the plans in a man's heart, but > IPEN-CNEN/SP is the Lord's purpose that prevails" > http://curiango.ipen.br/~mario Prov. 19.21 > > ---------- Forwarded message ---------- > > Nome: Edisson Quesada López > E-mail: [EMAIL PROTECTED] > > Cartago, March 21th, 1998. > > Urgent help!!! > > We are computer science's students of Instituto Tecnológico de Costa Rica and > we are working in a project of communication among PC's. Specifically, we > need to connect three computers all of them PC's, but one with Linux and > others with MSDOS. > > Our protocol suport, theorically yet, half duplex and we use the serial and > parallel ports. > Because other caracteristcs, we need something like kbhit function defined > in conio.h of C for MSDOS. This function is like a keypressed and we are > looking for something like that because we must emulate the following > procedure: > > ... > while (1) > { > do > { > printf("."); > } while (!kbhit()); > > if (c=getch()) > { printf("\r\nNormal %d\r\n",c); > } > else > { > printf("\r\nExtendido %d\r\n",getch()); > } > pausa > } > ... > > Thank you for your help. > > Ours names are > Evelio Morales A. > Edisson Quesada L. > > P.S. > We will work in this proiect until April 10th , of this year, so please send > us this information as quick as you can. > > Send us your response to any of the following addresses (if is possible, to > all of them) > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > What is the procedure to post messages to the group of Linux (LLP)??? -- Jens B. Jorgensen [EMAIL PROTECTED]
kbhit.c
Description: application/unknown-content-type-c_auto_file