#include int main(int argc, char **argv) { FILE *fpr; /*Char array to store string */ char str[100]; /*Opening the file in "r" mode*/ fpr = fopen(argv[1], "r"); /*Error handling for file open*/ if (fpr == NULL) { puts("Issue in opening the input file"); } /*Loop for reading the file till end*/ int linecount = 0; while(1) { if(fgets(str, 10, fpr) ==NULL) break; else linecount++; } /*Closing the input file after reading*/ fclose(fpr); FILE *fpw; /*Opening the file FILEW.TXT in "w" mode for writing*/ fpw = fopen(argv[2], "wb"); /*Error handling for output file*/ if (fpw== NULL) { puts("Issue in opening the Output file"); } fprintf(fpw, "%d\n", linecount); /*Closing the Output file after successful writing*/ fclose(fpw); return 0; }