Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void diff(FILE *infile1, FILE *infile2, FILE *outfile)
- {
- char file1_line[MAX_LINE_LEN] = "";
- char file2_line[MAX_LINE_LEN] = "";
- int line_number = 0;
- int num_differences = 0;
- /* Read a line from each file */
- fgets(file1_line, MAX_LINE_LEN, infile1);
- fgets(file2_line, MAX_LINE_LEN, infile2);
- /* Change this into a loop through the infiles */
- for (line_number=1; line_number<=MAX_LINE_LEN; line_number++)
- {
- if ( strcmp goes here )
- {
- fprintf(outfile, "File 1 (%d):%s",
- line_number, file1_line);
- fprintf(outfile, "File 2 (%d):%s",
- line_number, file2_line);
- num_differences++;
- fgets(file1_line, MAX_LINE_LEN, infile1);
- fgets(file2_line, MAX_LINE_LEN, infile2);
- }
- }
- /* Print the number of differences to the screen */
- printf("Number of differences found: %d\n", num_differences);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement