【发布时间】:2013-03-01 14:59:15
【问题描述】:
在下面的代码中,我用"gedit filename" 调用system。它正在使用指定的文件正确打开 gedit。
但是,在下一行中,我尝试打印修改后的数据(我将通过gedit 更新),但它不会等到gedit 退出。
strcpy(tt1,"gedit ");
strcat(tt1,tt);
system(tt1); //here gedit opens file
printf("\nFile data %s Location %s",getFileData(tt),tt); //this line executes before finishing gedit
请帮我等到system() 调用完成。
【问题讨论】:
-
tt包含什么? -
gedit可能像守护进程一样进入后台,许多 gui 程序都这样做。 -
tt 包含将用于 gedit 的文件名,例如gedit abc.txt 这里tt是abc.txt
-
从shell调用
gedit filename时,退出gedit前shell提示符是否返回? -
没有办法做到这一点..???
标签: c multithreading system wait