应该使用sprintf先格式化到一个字符串数组中,然后传入system。比如:#include<stdio.h>int main(){int seconds; scanf("%d",&seconds); char chars[100]; sprintf(chars,"shutdown -s -t %d",seconds); system(chars);}
system带参数
最新推荐文章于 2022-05-19 20:41:01 发布
应该使用sprintf先格式化到一个字符串数组中,然后传入system。比如:#include<stdio.h>int main(){int seconds; scanf("%d",&seconds); char chars[100]; sprintf(chars,"shutdown -s -t %d",seconds); system(chars);}