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
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.