Display the content of a file by a system call

Assignment Help Computer Engineering
Reference no: EM132080170

You need some help writing this code:

Here are some basic components for your program design. To simplify the matter, we'll use HW8.txt as input file, HW8.bin as binary output, and HW8c.txt as text output.

In "encoding.c", you have a function "encoding" which opens the text fiile "HW8.txt" for reading and the binary file "HW8.bin" for wrting. Then, read 4 characters at a time, pack them into an integer by a function "pack", manipulate the integer by "encryption", and write the encrypted integer into "HW8.bin" until the end of "HW8.txt". At the end of file, you may save some NULL ('\0') characters to make it 4 characters for the last integer. Close all open files.

In "decoding.c", you have a function "decoding" which opens "HW8.bin" for reading and a text file "HW8c.txt" for writing. Then, read an integer at a time, use the key from your partner to manipulate the integer by a function "decryption", unpack it into 4 characters by a function called "unpack", and save the 4 characters into "HW8c.txt". Close all open files.

The "encryption" function will shift an integer k bits to the left (or right) in circle in "encoding.c". Here k is the secrete key you share with your partner. The "decryption" will restore the encryption process in "decoding.c". That is, shifting k bits to the right (or left) in circle.

If you work in team, one person implement "encoding.c" and the other implement "decoding.c". You can give your header file and object file to your partner (encoding.h and encoding.o, or decoding.h and decoding.o), but not the source code. Your key and direction of circlic shift should be described and shared in the header file.

Presumably, you don't have your partner's "c" file, but you link the object file your partner provides, so your Makefile will be just using an existing object file for linking. Of course, you may just link with my object file. Then, you don't have a partner.

Your "main.c" is simple: display the content of "HW9.txt", call encoding, call decoding, and display the contents of "HW9c.txt". You can display the content of a file by a system call as follows, for example: system ("cat HW9.txt");

You should have the corresponding header file(s) for compilation. Again, you don't share your source code, but you share the header file(s) and the object files. The key is described in the header file(s).

Reference no: EM132080170

Questions Cloud

Write a javascript program with the following functions : You need some help on writing a JavaScript program with the following functions Displaythe current date and time in appropriate format.
Write a program which asks the user for an integer : Write a program which asks the user for an integer and then prints the following patterns based on that integer.
Prepare a java code to show a multiplication table : A multiplication table is printed out for a range of positive numbers. The user is prompted to start with a number for example 2.
Relationships that may exists between stakeholders : By using the information above, draw an appropriate ER diagram showing this information, make sure you show suitable relationships that may exists between stake
Display the content of a file by a system call : In "decoding.c", you have a function "decoding" which opens "HW8.bin" for reading and a text file "HW8c.txt" for writing.
Write a program which validates a users password : You need help writing this program in JAVA, this is an introductory java course, so if possible, keep it as basic/simple as possible .
Why should policymakers care about gdp : Despite the fact that GDP is not a flawless measure of prosperity, policymakers ought to think about it in light of the fact that a bigger
Graph the demand and supply curves : a. Graph the demand and supply curves. What is the equilibrium price and quantity in this market?
Calculate payroll for department and employee : Build an application that would allow the end-user to calculate an Employee's Gross Pay and the Department's average Gross Pay Report.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd