C++中是否有标准的getch()等价物
Is there a standard getch() equivalent in C++?
我知道getch不是一个标准的C/C++函数,但我喜欢它,因为它不需要在返回之前按enter键。所以我想知道在标准C++中是否有类似的东西具有相同的效果(不需要按enter键)?
我在这个网站上读到过类似的问题,但他们的回答都没有说明是否有标准的便携式等价物。
如果您使用其中一个"curses"库,例如ncurses
使用ncurses。这是最好也是最简单的选择。
示例代码:
#include <ncurses.h>
int main()
{
initscr(); /* Start curses mode */
printw("Hello World !!!"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */
return 0;
}
相关文章:
- 在C++STL中是否有Polyval(Matlab函数)等价物?
- python集合的C++等价物是什么.计数器
- C++中是否存在 std::conditional 的懒惰等价物?
- #include < conio.h> 和 getch() 方法之间的关系是什么?
- std::endl,在 Python 中是否有等价物?(返回 + 刷新)
- 如何在使用 getch 后在另一个字符串的末尾连接一个字符串
- 在本征C++中 MKL 的函数"zgges"等价物是多少?
- 为什么 getch 在按下函数或箭头键时返回三个值?
- getch() 像 dart 中的函数
- Ncurses CTRL + s hangs getch()
- Getch 不断输出相同的值
- 在C++中使用std或boost库的Qtimer等价物是什么
- GLM中的Java Matrix4.transform等价物
- 对于std::bitset,是否有一个ffs()等价物
- ncurses getch() 奇怪的输出?
- std::move() 或其在局部变量上的显式等价物可以允许 elision 吗?
- 控制台窗口未在开发C++中打开?即使也有 getch() ?
- 这个 matlab 代码的C++等价物是什么(fread matlab vs fread C/C++)?
- 对于wchar_t,字符(0)或'