#include <stdint.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> int main() { int fdr = open("dm.mp4", O_RDONLY); int fdw = open("cp.mp4", O_RDWR | O_CREAT,0777); const int MaxSize = 1024; uint8_t buf[MaxSize]; int ret = -1; while ((ret = read(fdr, buf, MaxSize))) { write(fdw, buf, ret); } close(fdr); close(fdw); return 0; }