1use sysconf to determine the maximum number of standard io


Midterm Take-home Examine

Deliverables: Source code and output file
Note: Cheating will receive anF

1. Use sysconf to determine the maximum number of standard I/O streams a process can open at a time. Then try to open this number of streams. How many can you open? Does it match what sysconf reports?
Hint see chapter 2.5.4

2. File I/O programming 

2.1 Write a BASH script to create a random file, "random1", of 2MB 
Hint: 2MB is 512 bytes x 4000, use ‘dd' command

2.2 Use ‘read()' and ‘write()' functions to write a program called ‘copy1' that emulates ‘cp' command to create a copy. 
Example: copy1 random1 random2

2.3 Replace ‘read()', ‘write()‘ in 2.2 above with ‘fread()' and ‘fwrite()', called ‘copy2' 

2.4 Add a loop of 100 in ‘2.2' and ‘2.3', called n'copy3' and ‘copy4', that use time() function to compare which one runs faster. Use ‘fprintf()' to output the results to the screen, right aligned to 78th column 

I/O Mode: Buffered (or unbuffered)
File Size: 1,003,202 bytes
File Last Modified Time: 11/01/2014 01:02:33pm
Total Run Time: 4,323 seconds
Input File Name: random1

3. Write a C program, named ‘hex', to perform like ‘hexdump'

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: 1use sysconf to determine the maximum number of standard io
Reference No:- TGS01509897

Now Priced at $60 (50% Discount)

Recommended (95%)

Rated (4.7/5)