Question: Write a program that reads the file 2F_binary_file. This file contains a two-dimensional array of 100 integers (indices 0 to 99); that is, 10x10. You

 Write a program that reads the file 2F_binary_file. This file contains

Write a program that reads the file 2F_binary_file. This file contains a two-dimensional array of 100 integers (indices 0 to 99); that is, 10x10. You are to read in the 5x5 top left corner of the array. That is, the values at indices 0-4, 10-14, 20-24, 30-34, and 40-44. You may only read 25 integers total. Do not read all 100 and throw some out. You will then write out the new 5x5 array to the output file, which is one of the command line arguments. Please write one integer per line (25 lines total). You should be able to cat the file afterwards and see the values.

2F_binary_file:

 !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc

correct output is:

0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 40 41 42 43 44

Grading script:

#!/bin/bash INPUT=2F_binary_file CORRECT_OUTPUT=ASCII_output if [[ $# != 1 ]] ; then echo "Usage: $0 " exit 1 fi gcc -o proj2F $1 if [[ $? != 0 ]] ; then echo "Compile failure!" exit 1 fi rm -f ./my_ASCII_output ./proj2F $INPUT my_ASCII_output if [[ ! -f my_ASCII_output ]] ; then echo "You did not generate the correct file output name." exit 1 fi diff $CORRECT_OUTPUT my_ASCII_output if [[ $? != 0 ]] ; then echo "Your output is not correct." exit 1 fi echo "Your program appears to be working correctly." echo "It compiles, runs, and generates the correct output." echo "Please upload this c file to Canvas, as per the instructions in the 2F prompt." echo "Grading will consist of the steps performed by this script, complemented by inspection of your code." 

Aisagned:Octeber 18,2018 Boe Octaber25th, 2018 lwhith means subnitd by om ea Oroober 20th, 2018) worth 4% af your grade t: Weiteo progrum t reals e e '2F.iy Thale coits a read The 5K5 Dop lettoomer at the array. That's 'he values ar indes 1-4, 10-14. 20-24 -M.an 0t Tou nay anly read 23 integers tatal, Doaut read all 100 Enea total You sbould be able oat'thEle akerwards ond seebevalu head seek prin dose cucaklerte or debuen. ach uf these functies Your prugram should raa as: Uroahthe peeraJer.sislsripe It ccepts suur seane es atiaput llowvtr.your actualsaur coe vitilbepe You thaald ahoolutady te tostirg your code the vraal !eo. Lit dccon't work there, you llbe penalined hoiy Ause thegnderah scit Aisagned:Octeber 18,2018 Boe Octaber25th, 2018 lwhith means subnitd by om ea Oroober 20th, 2018) worth 4% af your grade t: Weiteo progrum t reals e e '2F.iy Thale coits a read The 5K5 Dop lettoomer at the array. That's 'he values ar indes 1-4, 10-14. 20-24 -M.an 0t Tou nay anly read 23 integers tatal, Doaut read all 100 Enea total You sbould be able oat'thEle akerwards ond seebevalu head seek prin dose cucaklerte or debuen. ach uf these functies Your prugram should raa as: Uroahthe peeraJer.sislsripe It ccepts suur seane es atiaput llowvtr.your actualsaur coe vitilbepe You thaald ahoolutady te tostirg your code the vraal !eo. Lit dccon't work there, you llbe penalined hoiy Ause thegnderah scit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!