What is the equivalent to Posix popen() in the Win32 API?

dsimcha picture dsimcha · Jan 16, 2009 · Viewed 30.5k times · Source

Is there a rough equivalent to the Linux/Unix stdio.h popen() function in the Win32 API? If so, where can I find it?

Edit: I need to know this to patch an omission in the D standard library. Any answer must use only standard Win32 API, no MSVC-specific functions. Also, I'd prefer something that's not horribly low-level, if it exists.

Answer

Johannes Schaub - litb picture Johannes Schaub - litb · Jan 16, 2009

MSDN explains how you do what popen does using the Windows API in Pipe Handle Inheritance . Here it provides a well-documented example. It's way more low-level than the _popen function found in the runtime library linked by Jason, but uses the Win32 API exclusively.