I have a file with the following structure:
"width" "height" "gray_levels" "pix1" "pix1_length" "pixn" "pixn_length"
Basically, I have to convert this raw data of a raster scanned image back into an image.
Also depending on the amount of gray levels used there will be different character for each gray level. My problem is that I don't really know where to begin. I know that it's better if I have a 2D array, to which I would enter the integer value of different character for the gray level. So i.e. 0 = # (and then I would enter the ASCII value of #)
fscanf(inputfile,"%i %i %i", &x, &y, &gray_levels);
This line reads the dimension of the image for later processing, but I have no idea how to use it without creating a forest i.e. like 10 loops inside one another. I think the main problem is how to program it so that e.g. when first pixel is length 300, I make it to go to the next line in the array.
Also, I shouldn't use malloc because I haven't covered that topic yet. I need to create the size of the array at runtime, so I just created an array with the maximum size of 80*100.