4 int main(int argc, char *argv[]) {
6 /*Opening the file provided as a second argument*/
7 FILE *f = fopen(argv[2], "w");
9 printf("Error opening file!\n");
12 /*Saying hello to the name provided as a first argument*/
13 printf("Hello %s !\n", argv[1]);
14 fprintf(f, "Hello %s !\n", argv[1]);
17 printf("This is a C program expecting 2 arguments: the name to say hello to and the output file name\n");
18 printf("You have not provided the correct number of arguments\n");