Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSCI 2230- Programming Assignment 1: File Reader - Prof. Vernon W. Pine, Assignments of Digital Signal Processing

Programming assignment 1 for csci 2230, where students will become familiar with the linux environment, text editor, and compiler. The goal is to write an object-oriented program that reads a binary file and displays its content in decimal, octal, or hexadecimal. Students must handle errors and display the ascii character equivalent of the previous 10 bytes, aligning them with the previous line.

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-njs-1
koofers-user-njs-1 🇺🇸

3

(2)

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download CSCI 2230- Programming Assignment 1: File Reader - Prof. Vernon W. Pine and more Assignments Digital Signal Processing in PDF only on Docsity! CSCI 2230-001 Programming Assignment #1 Due: 18 February File Reader Goals You will become familiar with the Linux environment, text editor, and compiler. Additionally, you will learn how to open, read, and close binary files. The program will read a file and display the result in decimal, octal or hexadecimal. You shall implement your solution on the einstein Linux server. Your solution shall be object oriented. Your main function must be minimal; only instantiate the necessary objects, invoke the member functions of those objects, and possibly invoke a few free functions. This program is to be written individually. 1. Startup On program startup, the first argument will be a dash, followed by either a d, o, or x, indicating the mode of the display. A d indicates base 10, o indicates base 8 and x indicates base 16. The second argument is the name of the file to be displayed. If the command line arguments are incorrect or missing, you shall provide an informative error message and terminate your program. Do not prompt for any additional information from the user. Open and read the file, displaying 10 bytes in the indicated mode with 2 spaces between each byte. Display 5 spaces and then the ASCI character equivalent of the previous 10 bytes. Do not attempt to display the ASCII character equivalent for bytes with a value less than 3210. These characters are generally regarded as control characters and some have “nasty” side effects if displayed. Display a “space” for these characters. Move to a new output line and continue until encountering the end-of-file. The ASCII character equivalent for the last line shall align with the ASCII character equivalent for the previous line. 2. Example The following is an example of how your program will be called hw1 -d testfile.dat If testfile.dat contains abcABC12345def your program should display 97 98 99 65 66 67 49 50 51 52 abcABC1234 53 100 101 102 10 5def depending upon how the file was created, you may or may not see the new-line character (decimal 10) at the end of the file. 3. Deliverables Be sure to test your program carefully. It should handle most reasonable errors - when in doubt, ask. Submit a printout of your program, and a copy of your makefile in a manila envelope with a completed coversheet attached to the front. The required coversheet is available on my web site. Copy an executable version of your program named hw1 into your home directory. (Note: you cannot name your working homework 1 directory ”hw1”, since you will be moving the executable file to your home directory.) Make sure the permissions for hw1 are set correctly by executing the command chmod go+rx hw1 after you copy the executable to your home directory. You must also set read and execute permission on your home directory, by entering the following two commands from your home directory. cd chmod go+rx .
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved