#include<stdlib.h>
#include<stdio.h>
//用exce只能生成一個,然後退出,這不是我們想要的,所以用system
int main(int argc,char *argv[])
{
int a=0,end;
char buffer[100];
end=atoi(argv[1]);//第二個參數字符串轉化爲數字,表示要創建的文件數目
printf("form 0 to %d\n",end-1);//輸出需要創建的文件數目
for(a=0;a<end;a++)
{
sprintf(buffer,"touch ZZ%d.txt",a);/*將命令打到字符串中,touch是shell中創建文件的指令*/
system(buffer);//執行指令,創建從“ZZ0”到“ZZ(輸入數字減一)”的文件夾
}
return 0;
}