From: Bastian Dehn Date: Sat, 10 Feb 2024 13:44:48 +0000 (+0100) Subject: add header write bytes X-Git-Tag: v1.0.0^2~306 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=e5c8876feebeb0f848bdecdffa3508143c473d40;p=sane-kds-s2000w-net.git add header write bytes --- 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);