How can I run an external program from C and parse its output?

后端 未结 8 975
死守一世寂寞
死守一世寂寞 2020-11-22 04:18

I\'ve got a utility that outputs a list of files required by a game. How can I run that utility within a C program and grab its output so I can act on it within the same pr

8条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 04:39

    In Linux and OS X, popen() really is your best bet, as dmckee pointed out, since both OSs support that call. In Windows, this should help: http://msdn.microsoft.com/en-us/library/ms682499.aspx

提交回复
热议问题