0
我需要在execlp calls()
中使用多個顯示器。我想這樣的:將指示路徑前的顯示設置爲(execlp)
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("calling to execlp:\n\n");
execlp("DISPLAY=:0 /usr/bin/qtdisplay","qtdisplay", "-r", NULL);
execlp("DISPLAY=:1 /usr/bin/qtdisplay","qtdisplay", "-r", NULL);
printf("fail!");
exit(0);
}
但這種失敗,並顯示以下消息:execlp: No such file or directory
有什麼辦法與顯示器的工作?
你可以做兩個'execlp ()總是像這樣,如果第一個成功,你的原始程序將會消失。你可以使用'setenv()'來設置環境變量。 – 2014-10-07 02:15:39