1
在下面的代碼中,我打電話system
與"gedit filename"
。它正確地打開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'包含什麼? – 2013-03-01 15:02:09
''gedit'可能會像守護進程一樣進入背景,很多gui程序都會這樣做。 – Kevin 2013-03-01 15:03:41
tt包含將用於gedit的文件名,例如gedit abc.txt這裏是abc.txt – Galaxy 2013-03-01 15:05:07