C ++程序和cmd控制台之间的管道 [英] Pipe between C++ program and a cmd console
问题描述
我制作了一个 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屋!