I’m kind of newbie in C programming. I am trying to write a little application which compares 2 text files from the user, compare between them (line by line) and writes in a third file the differences between the 2 first.
I have chosen to use “fgets” command to read the lines, but my program crashes. There are no compilation errors. It fails on the “While”
Can you please take a look?
void main ()
printf ("\nPlease enter filename of first file: ");
printf ("\nPlease enter filename of second file: ");
// open both files
printf ("\nCannot open firstfile: %s\n",firstFile);
printf ("\nCannot open second file: %s\n",secondFile);
//let's read the lines until eof of the first given file.
while (fgets(firstFileLine, 50, firstHandle)!=NULL)
//Do the compare stuff here