我正在使用Emacs和gdb来调试一个使用conio的getch的c++程序,如下所示:
#include <conio.h>
int main(){
int c = getch();
cout << (char) c;
}如果我在main的第一行放置一个断点,gdb会挂起,什么也不会发生。我不认为输入文件(run < input.txt)可以工作。
我应该如何调试它?
发布于 2016-11-03 20:48:49
set new-console on会打开一个新的终端,你可以在其中输入,getch就可以工作了。
其他方法也可能有效,但我认为这一种方法很好。
https://stackoverflow.com/questions/40401241
复制相似问题