Question: Write a C program to create a binary ppm file with 1 0 0 0 by 1 0 0 0 pixels. It uses five input
Write a C program to create a binary ppm file with by pixels. It uses five input
colors to draw a picture. See sample runs. The input colors can be: red, green, blue,
yellow, orange, cyan, magenta, ocean, violet. The corners of the central part should use
the th and the th row, and the th and th column.
Restrictions on the file format:
no comment line after the file type specification
width number of columns and height number of rows formatted in ASCII
decimal in the second line, separated by a space
maximal value of color components given in the third line
Requirements on parallel execution:
The original process should write the header information into the image file.
Use fork to create child processes. Each child process writes rows of data
into the image file, and can use up to KB of memory.
The original process does not work on the pixels. It creates the child processes
to do so To avoid having multiple child processes simultaneously accessing the
image file, the parent process simply waits for one child process to terminate
before creating the next.
Other requirements:
You are not allowed to use standard IO library functions or graphics related
libraries.
The command line arguments include the following in order: i the name of the
image file; ii color for center; iii color for topleft corner; iv color for topright corner; v color for bottomleft corner; vi color for bottomright corner.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
