#include // open, close, O_RDONLY #include // read #include // printf, perror int main(int argc, char* argv[]) { int f1 = open(argv[1], O_RDONLY); if (f1 < 0) { perror("open"); return 1; } int f2 = open(argv[1], O_RDONLY); if (f2 < 0) { perror("open"); return 2; } char buf1, buf2; while (read(f1, &buf1, 1) && read(f2, &buf2, 1)) { printf("%c%c", buf1, buf2); } close(f1); close(f2); }