cp.c

PHOTO EMBED

Thu May 09 2024 15:33:49 GMT+0000 (Coordinated Universal Time)

Saved by @login123

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int main() {
    char a;
    int i, j;

    i = open("/home/cvr/22B81A05/f3.txt", O_RDONLY);
    j = open("/home/cvr/22B81A05/f4.txt", O_CREAT | O_WRONLY | O_TRUNC, 0666);

    while (read(i, &a, 1))
        write(j, &a, 1);

    printf("Copied file.\n");
    close(i);
    close(j);
    return 0;
}
content_copyCOPY