【发布时间】:2018-03-27 05:14:34
【问题描述】:
例如,猜猜我有一个编译的 c 程序,命名为“binaryOutput”。 而在 Unix 环境中, [root@blablabla ~ ] ./binaryOutput 打印出一些这样的结果 [0] [1] [0] [1] [1]
我想将这些结果用作另一个 c 文件的输入。
在 C 语言中,我可以运行该文件。
system("./binaryOutput") ;
在代码之后,我想将数字添加为数组的输入。 我该怎么做?
【问题讨论】:
-
你应该从这里查看
popen():lix.polytechnique.fr/~liberti/public/computing/prog/c/C/… -
会(来自 shell):
./binaryOutput|myprog可以接受吗?在myprog中,您只需阅读stdin。这是最简单的方法。