From 5dd8edc5711a342896e952bae28f086f78ec04a5 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 10 Feb 2024 15:05:47 +0100 Subject: [PATCH] add print header for convert --- tools/convert.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/convert.c b/tools/convert.c index 82fc05e..a6f0d3e 100644 --- a/tools/convert.c +++ b/tools/convert.c @@ -15,7 +15,7 @@ void read_file(const char* filename, blobdata* input) input->size++; } fseek(fptr, 0L, SEEK_SET); - printf("file size of %s: %i byts\n", filename, input->size); + printf("file size of %s: %i bytes\n", filename, input->size); input->data = malloc(sizeof(char) * input->size); fread(input->data, input->size, 1, fptr); @@ -48,7 +48,12 @@ void printf_header_bytes(const char* data) byte_count++; } - printf("\nheader has %i bytes\n", byte_count); + char* header = malloc(sizeof(char) * byte_count); + snprintf(header, byte_count, "%s", data); + printf("\nheader:\n%s\n", header); + printf("header has %i bytes\n", byte_count); + free(header); + header = NULL; } int main(int argc, char* argv[]) -- 2.39.5