In this project, you will write code to read and write images in PPM format. Your code should be able to read and write PPM files in P3 and P6 format.
Your program should be resistant to errors and should not segfault or produce undefined behavior. If an error occurs, it should print a message to stderr with “Error:” prefixed to a descriptive error message before returning a non-zero error code. I have a test suite designed to test the robustness of your program.
Your program (ppmrw) should have this usage pattern to convert a P3 or P6 image to P3:
ppmrw 3 [login to view URL] [login to view URL]
Your program (ppmrw) should have this usage pattern to convert a P3 or P6 image to P6:
ppmrw 6 [login to view URL] [login to view URL]
You should print an error if the image would not be 8 bit per channel.