From e856d62a39ac49ca3ecb884c407c9b600e3c8c13 Mon Sep 17 00:00:00 2001 From: "leo.muff" <leomuffmail@gmail.com> Date: Thu, 8 Jun 2023 11:34:25 +0200 Subject: [PATCH] started copyf --- copy.c | 8 +++++++- copy.h | 3 +++ copyf.c | 18 +++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/copy.c b/copy.c index 530e186..bdf307b 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 7921c2b..1a7d476 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 530e186..a2ee022 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; + } + } +} -- GitLab