Answered step by step
Verified Expert Solution
Link Copied!

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 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.
image text in transcribed

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

Students also viewed these Databases questions