cybersecurity · intermediate · ~15 min · safe pentest lab
Stream-compare files via fread chunks.
Implement int files_match(const char *a, const char *b) returning 1 if both files exist and have identical bytes, 0 if both exist but differ, -1 if either can't be opened.
Use a streaming compare rather than reading whole files into memory.
#include <stdio.h>
int files_match(const char *a, const char *b) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.