Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the <conio.h> header file on Linux? Why can't I find <conio.h>? [duplicate]

Possible Duplicate:
How to implement getch() function of C in Linux?

What is the equivalent Linux version of the conio.h header file from MS-DOS?

Is there a way to replace its functionality? e.g. getch()

I'm using gcc and the text editor Geany to compile C code.

like image 802
janniks Avatar asked Jan 09 '12 17:01

janniks


People also ask

Is conio H available in Linux?

conio. h is not present in Linux. You need to use curses or ncurses .

How do you solve conio H No such file or directory?

First, don't use <conio. h> as it is not supported on online judges. So remove it and the getch() . printf("enter the number %d",&i); printf("the number %d is "&i); printf("exit");


1 Answers

conio.h is a C header file used with old MS-DOS compilers to create text user interfaces. Compilers that target other operating systems, such as Linux-based, 32-bit Windows and OS/2, provide equivalent functionality through other header files and libraries.

The #include <curses.h> will give you almost all of the functionality provided by conio.h.

"ncurses" needs to be installed in the first place.

If you use the Apt package manager:

sudo apt-get install libncurses5-dev libncursesw5-dev 

If you use rpm:

sudo yum install ncurses-devel ncurses 

For getch, take a look at the "NCURSES Programming HOWTO" article.

like image 50
Sangeeth Saravanaraj Avatar answered Sep 21 '22 21:09

Sangeeth Saravanaraj