#include "ESPReader.h"

#include <stdio.h>
#include <stdlib.h>
#undef NDEBUG
#include <assert.h>

int main(void) {
	FILE *fp;
	errno_t ret = fopen_s(&fp, "Skyrim.esm", "rb");

	if (ret || !fp)
		return ret;

	fseek(fp, 0L, SEEK_END);
	size_t size = ftell(fp);
	rewind(fp);

	char *buffer = malloc(size);
	if (!buffer)
		return errno;

	size_t read = fread(buffer, sizeof(char), size, fp);
	assert(read == size);

	espr_print(buffer, size);

	return 0;
}
