diff --git a/copy.c b/copy.c index 530e186eba5cf690ee019f9e978e1d8374a2d409..bdf307b81713e2af0db8c7191e02064b3b3eedfc 100644 --- a/copy.c +++ b/copy.c @@ -1 +1,7 @@ -#include "copy.h" \ No newline at end of file +#include "copy.h" +#include <stdio.h> +#include <stdlib.h> + +int copy (char* src, char * dst, unsigned int buf_size){ + +} \ No newline at end of file diff --git a/copy.h b/copy.h index 7921c2b0096129ac8d7f04f13f53c3299597cc3a..1a7d476c38697db6691f370ee6e5796dcff2f1ab 100644 --- a/copy.h +++ b/copy.h @@ -1,4 +1,7 @@ #ifndef _COPYF_H_ #define _COPYF_H_ +int copy (char* src, char * dst, unsigned int buf_size) ; +int copyf (char* src, char * dst, unsigned int buf_size) ; + #endif diff --git a/copyf.c b/copyf.c index 530e186eba5cf690ee019f9e978e1d8374a2d409..a2ee0224f53a8ef0e5d2a0d99dab6d9ca13a711d 100644 --- a/copyf.c +++ b/copyf.c @@ -1 +1,17 @@ -#include "copy.h" \ No newline at end of file +#include "copy.h" +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> + +#define MEGA 1000000 +int copyf (char* src, char * dst, unsigned int buf_size){ + FILE* fp = fopen(src, "r"); + char* buffer[buf_size+1]; + while(fread(buffer, buf_size, 10*MEGA/buf_size, fp)){ + if (ferror(fp)) + { + printf("Error occured while reading file."); + return -1; + } + } +}