<conio.h> 在哪里?Linux上的头文件?为什么我找不到 <conio.h>?

<conio.h> 在哪里?Linux上的头文件?为什么我找不到 <conio.h>?

问题描述:

可能的重复:
Linux如何实现C的getch()函数?一个>

MS-DOS 中 conio.h 头文件的等效 Linux 版本是什么?

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

有没有办法替换它的功能?例如getch()

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

我使用 gcc 和文本编辑器 Geany 来编译 C 代码.

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

conio.h 是一个 C 头文件,与旧的 MS-DOS 编译器一起使用以创建文本用户界面.针对其他操作系统(例如基于 Linux 的 32 位 Windows 和 OS/2)的编译器通过其他头文件和库提供等效功能.

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.

#include 将为您提供 conio.h 提供的几乎所有功能.

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

ncurses"需要首先安装.

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

如果您使用 Apt 包管理器:

If you use the Apt package manager:

sudo apt-get install libncurses5-dev libncursesw5-dev

如果你使用rpm:

sudo yum install ncurses-devel ncurses

对于 getch,请查看 NCURSES 编程 HOWTO" 文章.

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