system带参数

来源:互联网 发布:网络人员业务流程 编辑:程序博客网 时间:2024/06/05 05:34
应该使用sprintf先格式化到一个字符串数组中,然后传入system。比如:#include<stdio.h>int main(){int seconds; scanf("%d",&seconds); char chars[100]; sprintf(chars,"shutdown -s -t %d",seconds); system(chars);}
0 0