Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pipe between C++ program and a cmd console

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.

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

like image 485
icarus Avatar asked Jul 30 '26 13:07

icarus


1 Answers

You can use _popen for this, it's included in the C stdlib, so it should work on Windows.

http://pubs.opengroup.org/onlinepubs/009696699/functions/popen.html

You can pass the name of the second executable to the popen call in the first program.

like image 56
Steven Morad Avatar answered Aug 01 '26 01:08

Steven Morad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!