C:无论如何将参数加载到系统()调用中

标签 c variables arguments system

是否可以在系统调用中添加参数?

类似的东西

system("rm %s %s", string1, string2)

最佳答案

system 函数的原型(prototype)是:

int system(const char *command);

所以,不。但是,怎么样:

snprintf(buffer, sizeof(buffer), "rm %s %s", target1, target2);
system(buffer);

关于C:无论如何将参数加载到系统()调用中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5482832/

相关文章:

C - 使用一个数组 - 位图将图像旋转 90 度(左右)

javascript - Runscope 在每个请求之前初始化时间戳变量

python - 在函数内、函数外使用声明的值

php - 在 PHP echo 中嵌入 javascript

c++ - 函数调用作为 C 宏的参数

c++ - 调用 accept() 导致 WSAEFAULT 10014 Bad address

为具有两个参数的单向链表创建 push() 方法

不同 .c 文件之间公共(public)变量的 c 语法错误

ruby-on-rails - Rails - UsersController#create 中的 ArgumentError - 参数太少

c - 引用用户传递的参数的单个字符