Exam 12: Streams and File IO

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Given the following code.The input file,in.dat,is a copy of the program code in this problem.How will the output file,out.dat,differ from the input file? // file: testQuestion.cc // test question: copy files: in.dat to out.dat // in.dat is a copy of a file containing this code. // use EOF to terminate copy loop #include <fstream> #include <cstdlib> // for exit() using namespace std; int main() { ifstream in; ofstream out; in.open("in.dat"); out.open("out.dat"); while(in >> ch) out << ch; return 0; }

(Essay)
4.9/5
(40)

cin is an output stream object of type ostream.

(True/False)
4.8/5
(37)

Assume you have opened and connected stream variables fileIn and fileOut.Assume further that you have finished with input file,but want to read the input file a second time.What is necessary to set the stream state to reread the file from the start? Explain.

(Essay)
4.7/5
(37)
Showing 41 - 43 of 43
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)