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 arg2 argv[0] = ./test argv[1] = arg1 argv[2] = arg2 $ mv test newtest $ ./newtest arg1 argv[0] = ./newtest argv[1] = arg1 $ ln -s newtest linktest $ ./linktest arg argv[0] = ./linktest argv[1] = arg |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |