This is the first time I'm working with 2d arrays and I have to read the pixels in the input file, then store the pixel from the input image file into the array. And there is a maximum width and height of 500. If the file's too big, then I have to print an error message. Also, my array should only be filled up to the dimensions of the input image file.
I have the code for everything up to that point but I'm not too sure how to approach this. I've defined max_width and height at the top of my file as 500 and I'm thinking of putting this part of the program into a new helper function. But I'm not completely sure how to start, I do know that the array would look something like this though:
I've searched for other similar questions, but I think what confuses me is: 1) the syntax of printing the error message/storing the values and 2) the values for my pixels in the input file are all in a single column; each value after the ppm format header is on a new line.
I'd post my code up, but everything that I have up to this point doesn't really relate to this part of the assignment But I will post a snippet of what the input file looks like:
NOTE: First three lines are the header information for the ppm format; the numbers that follow go like this: red, green, blue, red, green, blue, etc.
Thanks for taking the time to help! I really appreciate it.