int main(int argc,char *argv[])参数的应用
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> //a.out src.txt dest.txt //argv[0] int main(int argc,char *argv[]) { char src[20] = {0}; char dest[20] = {0}; int i; for(i = 0; i < argc; i++){ printf("%s\n",argv[i]); } return 0; }