Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (System calls) Write a C program that makes compressed copy of an existing file of bits (O's and l's) using system calls for file

image text in transcribed

1. (System calls) Write a C program that makes compressed copy of an existing file of bits (O's and l's) using system calls for file manipulation. For compression use the following rules: Compress only the sequence of length>- 16 l's or 0's; for example a sequence of 26 0's is replaced by -26- and a sequence of 78 1's is replaced by +78+ a. b. Sequence of 1's and 0's of length . Example input file: 010101 1010101010000000000000000000000000000000000001 This has 3 segments as shown by the different colors The compressed output file for this will be: 010101 101010101-36-1 The names of the two files, source and the destination are to be specified as command line arguments. Open the source file in read only mode and destination file in read/write mode. While the main function will carry out file opening and closing, a separate compress function needs to be written to do the actual compressing and copying MyCompress.c MyCompress! Your program should work with the large test file the TA will provide you. For simplicity in IO processing assume the input file of 1's and 0's is a file of characters. The output file will have characters of 1's and 0's as well as the compressed information as numerical value. While you may use the data given above for prototyping, you will need fairly large data files to get some realistic time measurements

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

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions