Home > Net >  Copy file without using standard library function in C
Copy file without using standard library function in C

Time:12-21

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?

CodePudding user response:

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);
  • Related