C ++程序和cmd控制台之间的管道 [英] Pipe between C++ program and a cmd console

查看:682
本文介绍了C ++程序和cmd控制台之间的管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个 C ++ 程序,它生成一个命令行并将命令转发给它。目前我将cmd控制台的输出发送到一个文件,我在我的C ++程序中读取它。但我想使用管道工作。

I made a C++ program which spawns a command line and forwards commands to it. At the moment I'm sending the output of the cmd console to a file, and I'm reading it in my C++ program. But I want to make this work with pipes.

是否可以从Windows cmd行写入命名管道?

Is it possible to write to a named pipe from the Windows cmd line? I haven't found anything significant on this subject.

推荐答案

你的术语让我有点困惑 - 但我假设你正在使用VC(Visual C ++)

Your terminology confuses me a bit - but I'm assuming that you are using VC (Visual C++)

我发现这个答案(类似问题)更好地解释了管道和叉如何工作(介绍管道示例

I found this answer (to a similar question) that better explains how pipes and forks work (Well explained pipes examples)

这篇关于C ++程序和cmd控制台之间的管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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