Skip to content
Snippets Groups Projects
Commit cd986479 authored by Alexis Roche's avatar Alexis Roche
Browse files

autoconf

parent b4fa8bce
No related branches found
No related tags found
No related merge requests found
coucou
\ No newline at end of file
Welcome to our seminar
\ No newline at end of file
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/fs.h> /* Definition of FICLONE* constants */
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include<stdlib.h>
#define FICLONE HAVE_FICLONE
void copy_files()
{
printf("pocos");
int dest_fd, src_fd;
src_fd = open("a", O_RDONLY);
dest_fd = open("b", O_WRONLY); /* Needs to exist; not checking this */
dest_fd = open("b", O_WRONLY);
#ifdef HAVE_FICLONE
printf("Using FICLONE\n");
//ioctl doesnt work
if (ioctl(dest_fd, FICLONE, src_fd) < 0) {
printf("error while copying the file");
printf("error while copying the file \n");
//so we copy the file line by line
char s[100] ;
int n;
while ((n = read(src_fd, s, sizeof(s))) >0){
write(dest_fd,s, n);
}
return;
}
#else
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment