Select Git revision
dragon.c 802 B
#include <stdio.h>
#include <stdlib.h>
#include <zlib.h>
#include "dragon_data.h" // Include the embedded binary data
#define DRAGON_BUFFER_SIZE 100000
// EXTRA CREDIT - print the Drexel dragon from embedded binary
extern void print_dragon() {
unsigned char *decompressed_data = (unsigned char *)malloc(DRAGON_BUFFER_SIZE);
if (!decompressed_data) {
fprintf(stderr, "Memory allocation failed!\n");
return;
}
uLongf decompressed_size = DRAGON_BUFFER_SIZE;
// Ensure correct decompression
if (uncompress(decompressed_data, &decompressed_size, DRAGON_BIN, DRAGON_BIN_SIZE) != Z_OK) {
fprintf(stderr, "Decompression fail\n");
free(decompressed_data);
return;
}
printf("%s", decompressed_data);
free(decompressed_data);
}