SWEN-250

C++ - File IO Activity

Overview

This exercise requires you to write C++ code that will encrypt and decrypt text files and read arguments from the command line

In this exercise you will be provided some starter files

  • You will need to write the software to meet the requirements (below)
  • You are provided two text files (which will be used for testing)
  • You are provided a Makefile
  • You are provided a test program (executable). This is compiled to run on hamilton
Requirements

You will write a program (filesec) which will perform the following functions
It will run from the command line as shown below:
> ./filesec -e [filename.txt] //This will encrypt a file. Any filename is allowed. Output will be filename_enc.txt
> ./filesec -d [filename.txt] //This will decrypt a file. Any filename is allowed. Output will be filename_dec.txt
When encrypting, each character will be changed by adding 100 to the ASCII value of the character. When decrypting, you will reverse the process

If an incorrect command is entered when running the program, print the usage as shown below:
Usage:
filesec -e|-d [filename]

Instructions
  1. Download the zipfile:
  2. filesec.zip
  3. Your finish implementation of the starter files filesecurity.cpp/.h and main.cpp. The output file MUST be filesec (the Makefile will do this for you)
  4. Implement the code for the functionality described in the requirements
  5. Build the code using make
  6. Test the code by typing make test. This will run your filesec executable from the command line.
  7. Check the results to make sure there are no failures.
    • Compare output.txt with your output to confirm success.

    NOTE: If you see an error "permission denied", when running make test, then run the command 'chmod 755 tester'
    This should fix any permissions errors

Submission
  • Submit your code AND ALL SUPPORTING FILES to a directory named filesec in your git respository.
  • Grading scheme

    • Clean build (10)
    • Each test passes (10) x 9 = 90
    • Bonus: 10 points: Add a -c command to copy the binary file logbook.jpg to logbook_copy.jpg.
      Add the command line option, usage and implementation code