int main( int argc, char *argv[] ) |
// test.c #include <stdio.h> int main( int argc, char *argv[] ) { int i; for (i = 0 ; i < argc ; i++) { printf("argv[%d] = %s\n", i, argv); } return 0; } |
$ gcc -Wall -o test test.c$ ./test arg1 arg2argv[0] = ./testargv[1] = arg1argv[2] = arg2$ mv test newtest$ ./newtest arg1argv[0] = ./newtestargv[1] = arg1$ ln -s newtest linktest$ ./linktest argargv[0] = ./linktestargv[1] = arg |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |