Question: in c++ Lab Exercise: binary file I/O This lab Exercise has you write a program that does file I/O in binary mode Write a program

in c++

Lab Exercise: binary file I/O

This lab Exercise has you write a program that does file I/O in binary mode

Write a program that

prompts the user

inputs the name of the input file, using getline

prompts the user

inputs the name of the output file, using getline

(You may assume without checking that the call to getline introduces no error)

tries to open the output file in binary mode (ios::binary)

prompts the user

inputs the name of the second output file, using getline

(You may assume without checking that the call to getline introduces no error)

tries to open the second output file in binary mode (ios::binary)

Loop:

read a byte from the input file, write the byte to the first output file,

read a byte from the input file, write the byte to the second output file,

read a byte from the input file, write the byte to the first output file,

read a byte from the input file, write the byte to the second output file,

and so on for as many byte as the input file has.

If the input fails without EOF, c&d

Close both output files.

If either output file is in an error state, c&d

Close the input file.

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!