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:
32
base16384.c
Normal file
32
base16384.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user