Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Parsing Header Info from a ppm Image write a program that consists of multiple source files to parse the header information from a ppm image.

Parsing Header Info from a ppm Image

write a program that consists of multiple source files to parse the header information from a ppm image. Some ppm images and some starter code will be provided. You will need to write the function to parse the header, as well as a makefile, and a header file. The files from this lab will be starter files for the third programming assignment The following files will be copied to your directory: mainDriver.c with starter code; need to fill in some code parse.c with header comment and #include for defs.h this is where the parseHeader() function goes defs.h with #includes and a spot for the prototype of the parseHeader() function two image files You will also need to write a makefile that at the very least contains a target for compilation. 2. Your parseHeader() function will need the file pointer sent to it from main() as well as pointers to the column value and the row value. Since the 3 parts of the header can be on separate lines or not, and may or may not have comments in between them, parsing the header can be tricky. Take a look at each of the image files to see what the headers look. If your program for this lab parses the columns and rows from those two files, then it will be sufficient for the lab. For PA3 in the lecture, however, you should make sure to add code to handle other variations of the header. You will use file I/O functions to read in character by character, or string by string, or an entire line at a time. There are many different ways that this can be done. You will have to take a look at the different functions available and think about what makes the most sense to you. Remember, that for this lab, the goal is just to parse from the header the columns and the rows and print those values to the user. But for PA3, you will have to add more code to continue parsing through the header so that you move the file pointer to the next item after the 255; then at that point, the image pixel data can be read in. 2 SAMPLE RUNS OF THE PROGRAM: ./a.out tiger.ppm width is 690, height is 461 ./a.out julia.ppm width is 500, height is 500

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago