如何将输入重定向到另一个程序? [英] How can I redirect input to another program?

查看:118
本文介绍了如何将输入重定向到另一个程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ShellExecuteA( NULL, "open", "program.exe", NULL, NULL, SW_SHOWNORMAL );


<我正在使用上面的行来运行program.exe,它立即包含一个字符串的cin。我怎样才能覆盖那个cin并直接输入一个字符串和我的shell执行命令?

I am using the above line to run program.exe which immediately contains a cin for a string. How can I override that cin and directly input a string along with my shell execute command?

我想在不编辑用于编译program.exe的任何代码的情况下这样做。

推荐答案


ShellExecuteA( NULL, "open", "program.exe", NULL, NULL, SW_SHOWNORMAL );


我使用上面的行来运行program.exe,它立即包含字符串的cin。如何覆盖cin并直接输入字符串以及我的shell执行命令。

I am using the above line to run program.exe which immediately contains a cin for a string. How can I override that cin and directly input a string along with my shell execute command.

您是否询问如何重定向输入/输出或如何将参数传递给子进程以及如何检索子项中传递的参数?

Are you asking how to redirect input/output or how to pass an argument to a child process and how to retrieve the passed argument in the child?





这篇关于如何将输入重定向到另一个程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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