0
这一切的Linux而不是Windows如何使用c中的路径更改xeyes的颜色?
你好,我想知道我可以改变xeyes的颜色一样,我们可以在终端做这样
xeyes -fg蓝色 现在我想做到这一点在C程序使用路径
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <malloc.h>
//#inlcude <windows.h>
#define LB_SIZE 1024
int main(int argc, char *argv[])
{
char fullPathName[] = "/usr/bin/X11/xeyes";
char *myArgv[LB_SIZE]; // an array of pointers
myArgv[0] = (char *) malloc(strlen(fullPathName) + 1);
strcpy(myArgv[0], fullPathName);
myArgv[1] = NULL; // last element should be a NULL pointer
execvp(fullPathName, myArgv);
exit(0); // should not be reached
}
如果我只需拨打的/ usr/bin中/ X11/xeyes它只是显示的眼睛
现在我想要添加的命令如/ usr/bin中/ X11/xeyes-FG,但其不工作
有什么建议吗?
没有工作xeyes颜色没有改变 – tjnapster555 2015-04-02 18:17:56
它工作时,我跑了这个例子 - 我可以附上截图,但这可能没有帮助。非正式的,我能看到的唯一问题是,如果在你的机器上搜索“rgb.txt”有什么不妥(这会导致命名颜色不起作用)。你可以用'strace'运行你的应用程序来检查它是否成功地打开了这个文件。 – 2015-04-02 21:20:50