#include <stdio.h>
int my_cp(const char *src, const char *dest){

    FILE *file_src = fopen(src, "r");
    if(!file_src) return 1;

    FILE *file_dest = fopen(dest, "w");
    /*if (!file_dest) {
        fclose(file_src);
        return 1;
    }*/

    //On ecrase les data de dest par celles de src

    //pas opti à voir si la mouli accepte
    int c = fgetc(file_src);
    while(c != EOF){  
        
        fputc(c, file_dest);
        c = fgetc(file_src);
    }

    fclose(file_src);
    fclose(file_dest);
    return 0;
}
/*
int main()
{
    
    //example.txt <-- Create a copy of me!
    //trashy.txt <-- rgqUvcNRfEucVnUIVpqyNnqKrEvXEchlYmqKwyDHrHqk#eO#BCh@uAKFaXrS@jtdnCvRPqwx#SgSiV_avkoQwJYl#Mv_@fJ#h#@FnLqmDOqwxsbdLv@WmhAc#LCxc@Fc
    

    printf("%d\n", my_cp("example.txt", "trashy.txt"));   // 0
    printf("%d\n", my_cp("new_file.txt", "example.txt")); // 1
    printf("%d\n", my_cp("example.txt", "new_file.txt")); // 0

    
    //example.txt <-- Create a copy of me!
    //trashy.txt <-- Create a copy of me!
    //new_file.txt <-- Create a copy of me!
    

    return 0;
}*/

