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 1000 by 1000 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 249th and the 250th row, and the 749th and 750th 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 10 child processes. Each child process writes 100 rows of data
into the image file, and can use up to 350KB of memory.
The original process does not work on the pixels. It creates the 10 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 I/O 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 top-left corner; (iv) color for topright corner; (v) color for bottom-left corner; (vi) color for bottom-right corner.
 Write a C program to create a binary ppm file with

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!