如何写到执行过程的标准输入? [英] How to write to stdin of execved process?

查看:58
本文介绍了如何写到执行过程的标准输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试execve从stdin读取的进程.我想为stdin准备一些数据,以便它可以成功执行.我该怎么办?

I'm trying to execve a process that reads from stdin. I want to prepare stdin with some data so it can execute successfully. How can I do that?

推荐答案

您将需要将execve调用派生到子进程中,然后创建从父进程到子级stdin的管道.

You will need to fork the execve call into a child process and then create a pipe from the parent process to the child's stdin.

请查看此链接,以获取有关如何使用管道的详细示例: http://tldp.org/LDP/lpg/node11.html

Take a look at this link for a detailed example on how to use pipes: http://tldp.org/LDP/lpg/node11.html

这篇关于如何写到执行过程的标准输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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