在 <conio.h> 中使用 _getch(),对"_"的重要性
using _getch() in <conio.h>, significance on "_"
所以我正在教自己 c++,我遇到了 conio.h
而且我通常对cin.get()有问题,有时我不得不复制它以保持鞋底打开...
法典:
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <conio.h>
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "Hi" ;
_getch();
return 0;
}
"_getch()"的"_"部分背后的意义是什么?
有关冗长且技术性的答案,请参阅此答案。 – 约阿希姆·皮勒堡
https://stackoverflow.com/a/228797/440558
根据MSDN的说法,Microsoft决定在VS2005中转向ISO C++标准。
他们弃用了 POSIX 名称(例如 getch
) 赞成 ISO 名称 ( _getch
)。
您可以在 VS 中使用 POSIX 名称,方法是在第一个标头包括之前声明:
#define _CRT_NONSTDC_NO_DEPRECATE
相关文章:
- #include < conio.h> 和 getch() 方法之间的关系是什么?
- 如何在使用 getch 后在另一个字符串的末尾连接一个字符串
- 为什么 getch 在按下函数或箭头键时返回三个值?
- C++类 公共和私人领域的重要性
- getch() 像 dart 中的函数
- Ncurses CTRL + s hangs getch()
- Getch 不断输出相同的值
- 我想了解为什么在这个例子中使用引用函数?或者引用在c++函数中的重要性
- ncurses getch() 奇怪的输出?
- 控制台窗口未在开发C++中打开?即使也有 getch() ?
- 在下面函数的返回中添加 const 限定符的重要性是什么?
- 调用 getch() 时的分段错误
- 使变量成为常数的重要性是什么?
- 类相对于数据结构的重要性
- BFS中队列大小的重要性
- getch() 函数在输入 key 时不执行任何操作
- 如何存储我从使用 getch(); 获得的用户输入
- C 中断或取消getch();
- 了解 QPainter 在 QOpenGLWidget 的 paintEvent 函数中的重要性
- 在C/C 中创建Custom Getch()方法