#include #include int main(int argc, char *argv[]) { if (argc == 3) { /*Opening the file provided as a second argument*/ FILE *f = fopen(argv[2], "w"); if (f == NULL){ printf("Error opening file!\n"); exit(1); } /*Saying hello to the name provided as a first argument*/ printf("Hello %s !\n", argv[1]); fprintf(f, "Hello %s !\n", argv[1]); fclose(f); }else{ printf("This is a C program expecting 2 arguments: the name to say hello to and the output file name\n"); printf("You have not provided the correct number of arguments\n"); exit(1); } exit(0); }