Skip to Content

I want to use conio.h functions like getch()

noty's picture

Hi all I know that conio.h is not part of C standard but I want to use it . Is there any way to use it under linux ? thanks

Pronco's picture

DOS only thing

Is getch an unbuffered character read, or sommat?

What're you trying to use out of conio.h?

- I'm a code junkie security enthusiast

Conceptor's picture

it may be

it may be clrsrc()

Diaa Radwan

YoussefAssad's picture

Nothing doing

conio.h is a Borland kaka for working with DOS console IO. DOS. Not linux.

Linux uses something called curses.


Pronco's picture

As I mentioned

it's a DOS only thing

If he does resurface, tell him to take a peek at setvbuf + getc and ncurses

setvbuf(stdin, 0, _IONBF, 0); c = getchar();

Dunno. It looks plausible to me, but I haven't tried it.

Would probably break 'doze sommat chronic'

- I'm a code junkie security enthusiast

YoussefAssad's picture

As you mentioned where?



Pronco's picture


- I'm a code junkie security enthusiast

noty's picture

I've found this

I've found this solution . it works good

int getch( )


struct termios oldt,


int ch;

tcgetattr( STDIN_FILENO, &oldt );

newt = oldt;

newt.c_lflag &= ~( ICANON | ECHO );

tcsetattr( STDIN_FILENO, TCSANOW, &newt );

ch = getchar();

tcsetattr( STDIN_FILENO, TCSANOW, &oldt );

return ch;


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Dr. Radut | forum