1
0
mirror of https://github.com/fumiama/base16384.git synced 2026-06-15 18:40:24 +08:00

Add files via upload

This commit is contained in:
源文雨
2020-04-16 14:18:16 +08:00
committed by GitHub
parent aef591fa11
commit 071f930558
4 changed files with 133 additions and 0 deletions

32
base16384.c Normal file
View File

@@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdlib.h>
#include "base16384.h"
#define CHOICE argv[1][1]
#define READ argv[2]
#define WRITE argv[3]
int main(int argc, char **argv){
FILE *fp = NULL;
FILE *fpo = NULL;
if(argc != 4){
fputs("Usage: -[e|d] inputfile outputfile", stderr);
fputs(" -e encode", stderr);
fputs(" -d decode", stderr);
exit(EXIT_FAILURE);
}
fp = fopen(READ, "rb");
fpo = fopen(WRITE, "wb");
if(!fp || !fpo){
fputs("IO error!", stderr);
exit(EXIT_FAILURE);
}
switch(CHOICE){
case 'e': encode(fp, fpo); break;
case 'd': decode(fp, fpo); break;
default: break;
}
return 0;
}