#include #include #include #include #define FILE_SIZE 325443890 #define WRT_BYTES 4096 int main(void) { struct stat stat_buf; int fd = 0, flag = 0; const size_t cnt = FILE_SIZE / WRT_BYTES; char arr[WRT_BYTES]; fd = open("this_file_name.mp4", O_RDWR|O_CREAT, 0666); fstat(fd, &stat_buf); flag = fcntl(fd, F_GETFD); fcntl(fd, F_SETFD, flag | FD_CLOEXEC); lseek(fd, 0, SEEK_CUR); ftruncate(fd, FILE_SIZE); lseek(fd, 0, SEEK_SET); for (int i = 0; i < cnt; ++i) { write(fd, arr, WRT_BYTES); } write(fd, arr, FILE_SIZE - (WRT_BYTES * cnt)); close(fd); return 0; }