#include #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_RDWR); if (fd == -1) { perror("Opening the file failed"); return 1; } while (1) { char buf[256]; int cnt = read(fd, buf, 256); if (cnt <= 0) break; for (int i = 0; i < cnt; ++i) buf[i] = toupper(buf[i]); lseek(fd, -cnt, SEEK_CUR); write(fd, buf, cnt); } close(fd); return 0; }