Создал(а) 'sk2a/main.c'
This commit is contained in:
parent
e3929f72b8
commit
42bd39bb6e
24
sk2a/main.c
Normal file
24
sk2a/main.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include "compressor.h"
|
||||
|
||||
int main(int argc,char** argv){
|
||||
if (argc != 4 || (argv[1][1] != 'c' && argv[1][1] != 'd')){
|
||||
printf("Usage: \n");
|
||||
printf(" Compress ./compress -c infile.txt outfile.compress\n");
|
||||
printf(" decompress ./compress -d outfile.compress infile.txt\n");
|
||||
return 0;
|
||||
}
|
||||
char* action = argv[1];
|
||||
char* infile = argv[2];
|
||||
char* outfile = argv[3];
|
||||
FILE* inf = fopen(infile,"r");
|
||||
FILE* outf = fopen(outfile,"w");
|
||||
if (action[1] == 'c'){
|
||||
compress(inf,outf);
|
||||
}
|
||||
else if (action[1] == 'd'){
|
||||
decompress(inf,outf);
|
||||
}
|
||||
fclose(inf);
|
||||
fclose(outf);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user