Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我system()用来打开和关闭我的代码与之通信的外部程序。但是,每次我使用该system()函数时,如果我从普通终端/shell 调用程序,我都会得到控制台输出,例如,每次调用时,system(killall [program] &)我都会收到一条Terminated消息。有没有办法抑制这种类型的输出?
system()
system(killall [program] &)
您应该使用execlp而不是 system ;)
https://www.securecoding.cert.org/confluence/display/seccode/ENV04-C.+Do+not+call+system()+if+you+do+not+need+a+command+processor