【发布时间】:2015-04-01 20:32:23
【问题描述】:
所有这些都在 Linux 而非 Windows 中
你好,我想知道如何像在终端中那样改变 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 之类的命令,但它不起作用
有什么建议吗?
【问题讨论】: