Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started