在我的C++程序中使用linux命令。試圖從數組列表中下載url,一旦下載完成,下一個開始....目前只下載數組中的第一個位置,然後停止。C++調用linux命令fork childs
有人看到我正在做的錯誤嗎?
// Begin the downloading process
pid_t child = 0;
child = fork();
if (child < 0)
{
cout << "Process Faileld to Fork<<endl;
return 1;
}
if (child == 0)
{
wait(NULL);
}
else
{
for(int i = 0; i < numberOfDownloads; i++)
{
execl("/usr/bin/wget", "wget",locations[i], NULL);
}
}
試圖下載使用命令wget的東西,但我得到一個錯誤
您能否提供一個完整的可編譯示例 - 然後我可能會嘗試使用您的代碼而不是忽略您的問題 –