From: Bastian Dehn Date: Sat, 10 Feb 2024 14:05:47 +0000 (+0100) Subject: add print header for convert X-Git-Tag: v1.0.0^2~305 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=5dd8edc5711a342896e952bae28f086f78ec04a5;p=sane-kds-s2000w-net.git add print header for convert --- 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[])