(
source)
1 /*------------------------------------------------------------------------
2 |
3 | File: exec02.c
4 |
5 | Description: Calls execlp to execute printArgs
6 | with "command line arguments".
7 |
8 | Created: 8 Jan 15
9 | Author: glancast
10 |
11 +-----------------------------------------------------------------------*/
12
13
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <unistd.h>
17
18 int main(int argc, char *argv[])
19 {
20 execlp("printArgs", "A", "B", "C", (char *) 0);
21 printf("execlp failed!\n");
22 return 0;
23 }
Output:
argv[0] = 'A'
argv[1] = 'B'
argv[2] = 'C'