Reputation: 31
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
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