[英]Executing linux commands with c
Is there any way to execute Linux commands with c without using execlp()
, like predefined functions or something else. 有什么方法可以使用c执行Linux命令而不使用
execlp()
,例如预定义函数或其他功能。
Thanks. 谢谢。
如果需要命令输出,请使用system()
或popen()
。
system(const char *command);
sounds to be what you want 听起来就是你想要的
You can use system
. 您可以使用
system
。 It execute the command, but take care since it invoke a shell to interpret the command (breaking argument list on space, ...). 它执行命令,但是要小心,因为它会调用外壳程序来解释命令(在空格上断开参数列表,...)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.