Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Programming Create two C programs. The first program (named AsciiToBinary) will read data from an ASCII file and save the data to a new

C Programming

Create two C 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

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 signed integers, 10 floating point numbers, and 10 lines of text. There will be only one data item per line, and each line of text will contain up to 40 characters (including ' ' and the NULL terminator).

Examples of each line of text in the ASCII file:

262 6738.2342 To program or not to program... 

The data contained in the binary file (both reading from and writing to) will be 10 signed integers, 10 floating point numbers (of type double), and 400 characters. You may find it helpful to think of the 400 characters as 10 sets of 40 characters each.

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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

Define Management or What is Management?

Answered: 1 week ago

Question

What do you understand by MBO?

Answered: 1 week ago