|
|
1.1 root 1:
2:
3: argv C Language argv
4:
5:
6:
7:
8: Argument passed to main()
9:
10: char *argv[];
11:
12: argv is an abbreviation for ``argument vector''. It is the
13: traditional name for a pointer to an array of string pointers
14: passed to a C program's main function; by convention, it is the
15: second argument passed to main. By convention, argv[0] always
16: points to the name of the command itself.
17:
18: ***** Example *****
19:
20: This example demonstrates both argc and argv[], to recreate the
21: command echo.
22:
23:
24: main(argc, argv)
25: int argc; char *argv[];
26: {
27: int i;
28:
29:
30:
31: for (i = 1; i < argc; ) {
32: printf("%s", argv[i]);
33: if (++i < argc)
34: putchar(' ');
35: }
36:
37:
38:
39: putchar('\n');
40: return 0;
41: }
42:
43:
44: ***** See Also *****
45:
46: argc, C language, envp, main()
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.