#include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, "Wrong argument count!\n"); return 1; } int fd = open(argv[1], O_RDONLY); if (fd == -1) { perror("Opening the file failed"); return 1; } unlink(argv[1]); write(1, "Reading and printing the file:\n", 31); while (1) { char buf[256]; int cnt = read(fd, buf, 256); if (cnt <= 0) break; write(1, buf, cnt); } close(fd); return 0; }