OBJECTIVES

To refresh the development of C programs by designing, implementing, and testing a solution for a simple problem.

PROBLEM

Design a C program called producer.c that reads a text file (file containing ASCII characters) and encodes all characters as binary by using characters 1 and 0 to represent binary 1 and 0 respectively. Also design a program called consumer.c that will read your produced binary file and converts the contents of the binary file into a sequence of ASCII characters. Use operating system tools such as diff to check if the original and the sequence of characters generated by your consumer program are the same.

TESTING

You are to use the arrangement below to test your solution. As illustrated, the file test.out is the encoded version of the producerTest.txt file. Your consumer program will process the test.out file and will create the file consumerTest.txt.

producerTest.txt -> producer.c -> test.out -> consumer.c -> consumerTest.txt

You are to copy the contents of the following quote from Linus Torvalds to your producerTest.txt file.

UNIX has a philosophy, it has 25 years of history behind it, and most importantly, it has a clean core. It strives for something - some kind of beauty. And that's really what struck me as a programmer. Operating systems that normal home users are used to, such as DOS and Windows, didn't have any way of life. Nobody tried to design Windows - it just grew in random directions without any kind of thought behind it. [...] I don't think Microsoft is evil in itself; I just think that they make really crappy operating systems. Linus Torvalds

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.