相关疑难解决方法(0)

为什么我在Linux上找不到<conio.h>?

可能重复:
如何在Linux中实现C的getch()函数?

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

有没有办法取代它的功能?例如getch()

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

c linux gcc

64
推荐指数
4
解决办法
24万
查看次数

如何在我的C++程序中获取和使用头文件<graphics.h>?

我一直在寻找头文件及其相关库的源代码,以便将它与我的C++程序集成.

同时,我对那些适用于多个编译器的跨平台库感兴趣.为了更明确,我在谈论那些用于在C++中绘制形状,线条和曲线的库.

c++ graphics

14
推荐指数
3
解决办法
10万
查看次数

在Linux上使用kbhit()和getch()

在Windows上,我有以下代码来查找输入而不中断循环:

#include <conio.h>
#include <Windows.h>
#include <iostream>

int main()
{
    while (true)
    {
        if (_kbhit())
        {
            if (_getch() == 'g')
            {
                std::cout << "You pressed G" << std::endl;
            }
        }
        Sleep(500);
        std::cout << "Running" << std::endl;
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,看到没有conio.h,在Linux上实现这一点的最简单方法是什么?

c++ linux getch conio kbhit

8
推荐指数
3
解决办法
3万
查看次数

标签 统计

c++ ×2

linux ×2

c ×1

conio ×1

gcc ×1

getch ×1

graphics ×1

kbhit ×1