Update sk1/compressor.c
This commit is contained in:
parent
1a5daf1c34
commit
b81dd59593
@ -1 +1,21 @@
|
|||||||
@
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int copy_file(const char *a, const char *b)
|
||||||
|
{
|
||||||
|
FILE *x = fopen(a, "rb"); if (!x) return -1;
|
||||||
|
FILE *y = fopen(b, "wb"); if (!y) { fclose(x); return -1; }
|
||||||
|
int c, n = 0;
|
||||||
|
while ((c = fgetc(x)) != EOF)
|
||||||
|
{
|
||||||
|
fputc(c, y);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
fclose(x);
|
||||||
|
fclose(y);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int compress_1(const char *a, const char *b){return copy_file(a,b);}
|
||||||
|
int compress_2(const char *a, const char *b){return copy_file(a,b);}
|
||||||
|
int decompress_1(const char *a, const char *b){return copy_file(a,b);}
|
||||||
|
int decompress_2(const char *a, const char *b){return copy_file(a,b);}
|
||||||
|
Loading…
Reference in New Issue
Block a user