From e5c8876feebeb0f848bdecdffa3508143c473d40 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sat, 10 Feb 2024 14:44:48 +0100 Subject: [PATCH] add header write bytes --- tools/convert.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/convert.c b/tools/convert.c index a6d41a1..82fc05e 100644 --- a/tools/convert.c +++ b/tools/convert.c @@ -32,6 +32,25 @@ void write_file(blobdata* output) fptr = NULL; } +void printf_header_bytes(const char* data) +{ + const int header_spaces = 3; + const char space = 0x0a; + int space_count = 0; + int byte_count = 0; + + while(space_count < header_spaces && byte_count < 50) { + printf("%02hhx ", data[byte_count]); + if (data[byte_count] == space) { + space_count++; + } + + byte_count++; + } + + printf("\nheader has %i bytes\n", byte_count); +} + int main(int argc, char* argv[]) { blobdata input; @@ -47,6 +66,7 @@ int main(int argc, char* argv[]) kds_s2000w_convert_jpg_to_pnm_With_depth(&input, &output, 8); kds_s2000w_convert_terminate(); + printf_header_bytes((const char*) output.data); write_file(&output); free(input.data); -- 2.39.5