From 6a2a5f799729e2ee3cbd1255f2dd59ee9b56ff97 Mon Sep 17 00:00:00 2001 From: Hofmann Jonas Date: Tue, 18 Nov 2025 08:59:40 +0100 Subject: [PATCH] further testing --- imageInput.c | 17 +++++++++++------ testFile.info2 | Bin 163 -> 26 bytes 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/imageInput.c b/imageInput.c index da49d25..e17d387 100644 --- a/imageInput.c +++ b/imageInput.c @@ -24,7 +24,7 @@ GrayScaleImageSeries *readImages(const char *path) FILE *readSource; unsigned int numberOfBytesToRead = 0; const unsigned int amountOfStatusInfoToRead = 1; - char headerString[sizeof("__info2_image_file_format__")] = "__info2_image_file_format__"; + char headerString[sizeof("__info2_image_file_format__\0")] = ""; //speicher allocaten weil *series auf null zeigt !!!!!!!! @@ -88,10 +88,10 @@ unsigned int readStatusInfo(FILE *source, char *const headerString, unsigned int { unsigned int bytesToRead = 0; - fread(headerString, sizeof(*headerString), amountToRead, source); - fread(imageCount, sizeof(*imageCount), amountToRead, source); - fread(imageWidth, sizeof(*imageWidth), amountToRead, source); - fread(imageHeight, sizeof(*imageHeight), amountToRead, source); + fread(headerString, sizeof("__info2_image_file_format__\0"), amountToRead, source); + fread(imageCount, 4, 1, source); + fread(imageWidth, sizeof(int), amountToRead, source); + fread(imageHeight, sizeof(int), amountToRead, source); bytesToRead = (*imageWidth) * (*imageHeight); // state of debugging: @@ -100,7 +100,12 @@ unsigned int readStatusInfo(FILE *source, char *const headerString, unsigned int // return nonsensical numbers // is the sizeof() command correct?? printf("hier\n"); - printf("bytes to read = %u", bytesToRead); + printf("stringsize: %lld\n", sizeof(headerString)); + printf("string: %send\n", headerString); + printf("count: %u\n", *imageCount); + printf("width: %u\n", *imageWidth); + printf("height %u\n", *imageHeight); + printf("bytes to read = %u\n", bytesToRead); return bytesToRead; } diff --git a/testFile.info2 b/testFile.info2 index 86c028aa6e3659c877027bd8162a76794eb79767..1ea3b4c2c12dae2ce08c20253f12fba140248f8d 100644 GIT binary patch literal 26 RcmXTU&rOXlNlaJ3003Yy1&{y$ literal 163 qcma!#&&*59H;T{9O-xUXPs_{!68S~Bi6!yzObi@ANGV{X*Z=@TD+;&(