system-function call asynchron?

╄→гoц情女王★ 提交于 2019-12-08 04:49:54

问题


At one place in a code i call an external tool with the system-Call. I work with Wine and program with C.

The call is like this:

system("blabla.exe outfile");

The command is dynamically generated to change the outfile. A few lines later i try to open the generated file with fopen, but fopen returns NULL.

If i change the call to the following everything works:

system("blabla.exe outfile");
Sleep(2000);

But i don't like to wait 2 seconds... And this solution is very bad. I think the system-Call works synchron? So the sub-process an all its (File-)Handles should be closed after the system-Call, not? I'm a bit confused about this.

Thanks


回答1:


system call is synchronous, according to the man page it returns after the execution ends. I suspect there's something with wine flushing file handles.



来源:https://stackoverflow.com/questions/6822264/system-function-call-asynchron

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!