subject

For this lab, you are going to create two programs. The first program (named AsciiToBinary) will read data from an ASCII file and save the data to a new file in a binary format. The second program (named BinaryToAscii) will read data from a binary file and save the data to a new file in ASCII format.

Background Preparation:

Review file I/O for ASCII and binary formats, including the fread(), fwrite() and fprintf() functions.
Review your notes on Command Line Parameters and/or find information online at a site such as https://www. tutorialspoint. com/cprogramming/c_command_line_arg uments. htm

Specifications:
Both programs will obtain the filenames to be read and written from command line parameters. For example:

bash$ AsciiToBinary ascii_in binary_out

bash$ BinaryToAscii binary_in ascii_out

The data contained in the ASCII file (both reading from and writing to) will be 10 floating point numbers, 10 lines of text, and 10 signed integers. There will be only one data item per line, and each line of text will contain no more than 40 characters (including '\n' and the NULL terminator).

The data contained in the binary file (both reading from and writing to) will be 10 floating point numbers (of type double), 400 characters, 10 signed integers. You may find it helpful to think of the 400 characters as 10 lines of 40 characters each. When writing the floating point values to the ASCII output file, write them to four decimal places.

Sample ASCII and binary format files are provided. The data in the two files correspond to each other. There will be no blank lines found in either file.

The specific method that you use to read and write the data is up to you. You may wish to read all the data from the input file before writing to the output file, or you may wish to write each data element as it is read.

Be sure to close both files (input and output) before exiting the program.

Compiling:
Your programs should both compile using a single Makefile (i. e. the make command will compile both programs). Therefore, your Makefile will have at least four targets - all (which will be the uppermost target in the file), AsciiToBinary, BinaryToAscii, and clean (the last target in the file). The executable names do not need to conform to the standard naming conventions used for CS262. However, all directories and source files do need to adhere to these standards.

Testing:
Besides testing your code with your usual methods, you should also test your programs by reading an ASCII file, converting it to binary, then reading the binary file and converting it to ASCII. The new ASCII file should match exactly with the original ASCII file.

acsii_file. txt

https://www. dropbox. com/s/bwy86vpyozgq9xn/ascii_file. txt?dl=0

binary_file. bin

https://www. dropbox. com/s/5cujl5vob4ns1wf/binary_file. bin?dl=0

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Rachel completed typing an official document with a word processing program. she wants to make sure that her document has no typographical errors. she also wants all headings to have the same font. which features in a word processing program should she use? rachel should use the feature in a word processing program to find typographical errors. she should apply to have uniform headings.
Answers: 1
question
Computers and Technology, 23.06.2019 01:20
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
How many points do i need before i can send a chat
Answers: 1
question
Computers and Technology, 25.06.2019 06:00
In 2 to 3 sentences, describe how you would change the background of a group of cells
Answers: 1
You know the right answer?
For this lab, you are going to create two programs. The first program (named AsciiToBinary) will rea...
Questions
Questions on the website: 13722367