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;
}

 

posted @ 2016-05-23 18:07  我有一壶酒  阅读(504)  评论(0编辑  收藏  举报