开发者

what is the c code to execute xeyes or xclock?

开发者 https://www.devze.com 2023-01-07 09:17 出处:网络
which function do i use to give such linux te开发者_StackOverflow中文版rminal calls in my c program?system would be the correct posix call. It takes a pointer to char as the command to be executed. Se

which function do i use to give such linux te开发者_StackOverflow中文版rminal calls in my c program?


system would be the correct posix call. It takes a pointer to char as the command to be executed. See man 3 system. However system can be completely corrupted by environment variables and an harder-to-use alternative is exec (see here).

A little example to illustrate:

system("xeyes");
system("rm -rf $HOME"); /* never ever try this, really */
0

精彩评论

暂无评论...
验证码 换一张
取 消