使得valgrind能够在c ++需要它时读取用户输入 [英] making valgrind able to read user input when c++ needs it

查看:142
本文介绍了使得valgrind能够在c ++需要它时读取用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用valgrind运行我的c + +程序,但我有一些点在程序中需要用户从stdin输入,但是当我运行valgrind,它不会让用户输入任何程序,是有一个方法呢?



已全部搜索,但尚未找到答案。

解决方案

我没有尝试,但我发现这在手册页:

   -  input-fd =< number> ; [default:0,stdin] 
指定用于从
用户读取输入的文件描述符。每当valgrind需要提示用户
作出决定时使用。

如果你为valgrind指定一个不同的fd(比如说3)来输入,会发生什么? / p>

I am trying to run my c++ program with valgrind, however I have some points in the program which require user input from stdin, but when i run with valgrind, it wont let the user input anything for the program, is there a way around this?

Been searching all around but have not found the answer.

解决方案

I haven't tried it, but I found this in the man pages:

--input-fd=<number> [default: 0, stdin]
              Specify the file descriptor to use for reading  input  from  the
              user.  This  is  used whenever valgrind needs to prompt the user
              for a decision.

What happens if you specify a different fd (say, 3) for valgrind to use for input?

这篇关于使得valgrind能够在c ++需要它时读取用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆