Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

lab2.c will contain a main method which should: o Require 2 command line arguments to be passed at execution: an input file name and an

image text in transcribedimage text in transcribed

lab2.c will contain a main method which should:

o Require 2 command line arguments to be passed at execution: an input file name and an output file name. If these arguments are not provided, the program should exit with a status of 1and print some error message.

o Open the input file for reading and the output file for writing. If either fails, return 1and printsome error message.

o Using the functions in ppm_utils, read in the image file creating an image_t* struct

o Using the functions in ppm_utils, write the same image out as a P6 ppm image

o free() the pixel_t* array and the image_t*struct

o close() the open files

o return0

ppm_utils.c should implement all the function defined in ppm_utils.h

including:

o header_t read_header(FILE* image_file);

o void write_header(FILE* out_file, header_t header);

o image_t* read_ppm(FILE* image_file);

o image_t* read_p6(FILE* image_file, header_t header);

o image_t* read_p3(FILE* image_file, header_t header);

o void write_p6(FILE* out_file, image_t* image);

o void write_p3(FILE* out_file, image_t* image);

image text in transcribed

Need help with the last two files. lab2.c and ppm_utils.c

Thank you!

# include "ppm utils. h" image_t* read_ppm (FILE* image_file) header_t header - read_header (image_file); image-t* image = NULL; if (strcmp("P3", heade r . MAGICNUMBER) 0) { - image readps (imagefile, header); else if (strcmp ("P6", header.MAGIC_NUMBER)0) l image read-p6(image-file, header); - - return image; # include "ppm utils. h" image_t* read_ppm (FILE* image_file) header_t header - read_header (image_file); image-t* image = NULL; if (strcmp("P3", heade r . MAGICNUMBER) 0) { - image readps (imagefile, header); else if (strcmp ("P6", header.MAGIC_NUMBER)0) l image read-p6(image-file, header); - - return image

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

Logidata+ Deductive Databases With Complex Objects Lncs 701

Authors: Paolo Atzeni

1st Edition

354056974X, 978-3540569749

More Books

Students also viewed these Databases questions

Question

14.3 Contingency Tables

Answered: 1 week ago