Commit d41cdb6e authored by Sam Schmalzried's avatar Sam Schmalzried

basic makefile

parent d643916c
CC=gcc
CFLAGS=-g
challenge1: challenge1.c
$(CC) -o challenge1 challenge1.c
\ No newline at end of file
File added
......@@ -6,7 +6,7 @@ void hexToBinary(char*, char*);
char* hexQuads(char);
void binaryTo64(char*, char*);
char quads[16][5] = {
static const char quads[16][5] = {
"0000",
"0001",
"0010",
......@@ -25,22 +25,26 @@ char quads[16][5] = {
"1111"
};
static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int main(int argc, char* argv[]) {
if (argc == 1) {
printf("Invalid number of arguments\n");
exit(0);
}
int argSize = sizeof(argv[1]);
char* binaryString = calloc(sizeof(char), 4*argSize);
size_t argSize = sizeof(argv[1]);
char* binaryString = malloc(4*(argSize+1));
char* base64String = malloc(argSize);
hexToBinary(argv[1], binaryString);
printf("%s\n", binaryString);
binaryTo64(binaryString, base64String);
free(binaryString);
//free(base64String);
free(base64String);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment