kkk001
kkk001

Reputation: 31

Copy file without using standard library function in C

How can I copy a file without using standard C library functions in Linux? In other words, I would like to copy a file directly with system calls. Is it possible?

Upvotes: 0

Views: 477

Answers (1)

KamilCuk
KamilCuk

Reputation: 142005

file directly with system calls. Is it possible?

In pseudocode, using sendfile:

int in = open("input", ...);
fstatat(in, &stat);
int out = open("output", ...);
sendfile(in, out, NULL, stat.st_size);

Upvotes: 1

Related Questions