Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Linux上,调试C++;在EclipseCDT中使用gdb的应用程序,如何向stdin输入内容? 在Linux上,我尝试用Eclipse CDT中的GDB调试C++应用程序。_C++_Eclipse_Gdb_Stdin_Eclipse Cdt - Fatal编程技术网

在Linux上,调试C++;在EclipseCDT中使用gdb的应用程序,如何向stdin输入内容? 在Linux上,我尝试用Eclipse CDT中的GDB调试C++应用程序。

在Linux上,调试C++;在EclipseCDT中使用gdb的应用程序,如何向stdin输入内容? 在Linux上,我尝试用Eclipse CDT中的GDB调试C++应用程序。,c++,eclipse,gdb,stdin,eclipse-cdt,C++,Eclipse,Gdb,Stdin,Eclipse Cdt,例如,应用程序applic.exe接受一些命令行参数arg1和arg2,并且它需要一些关于stdin的数据(例如,从文件input.txt) 通常,要在控制台中运行应用程序,我会执行以下操作: cat input.txt | applic.exe arg1 arg2 在控制台中使用gdb,我可以做到: gdb applic.exe (gdb) run applic.exe arg1 arg2 < input.txt gdb applic.exe (gdb)运行applic.exe ar

例如,应用程序
applic.exe
接受一些命令行参数
arg1
arg2
,并且它需要一些关于
stdin
的数据(例如,从文件
input.txt

通常,要在控制台中运行应用程序,我会执行以下操作:

cat input.txt | applic.exe arg1 arg2
在控制台中使用gdb,我可以做到:

gdb applic.exe
(gdb) run applic.exe arg1 arg2 < input.txt
gdb applic.exe
(gdb)运行applic.exe arg1 arg2

在Eclipse中使用gdb可以做到这一点吗?我知道如何在Eclipse调试配置中指定参数(和环境),但是关于
stdin

Eclipse中有控制台选项卡(在IDE底部),您可以将数据放在这里。

而不是在参数选项卡中输入重定向,将其附加到调试配置中的可执行文件名中。

确保从可用的控制台中选择gdb控制台。我认为op要求自动执行此操作,而不是每次复制和粘贴(可能是一个非常大的输入文件!),那么将文件名作为参数传递怎么样,然后打开它在程序中读取?是的,这可以作为一种解决方法。我不确定是否可以这样做,在运行配置中有一个指定输出文件的选项,但对于输入,它表示需要连接一个控制台。