Cross-platform redirect of standard input and output of spawned process in native C/C++ (edit with solution)

后端 未结 2 644
小蘑菇
小蘑菇 2020-12-17 21:49

I have a string command I\'d like to execute asynchronously while writing to its input and reading its output. Sounds easy, right, the devil is in the cross-platform. I\'m t

2条回答
  •  Happy的楠姐
    2020-12-17 22:11

    for converting windows HANDLEs to C file descriptors use _open_osfhandle http://msdn.microsoft.com/en-us/library/bdts1c9x%28VS.71%29.aspx

    EDIT: this example once helped me aswell with a similar problem: http://www.halcyon.com/~ast/dload/guicon.htm

提交回复
热议问题