COM1100 -- Winter2000 -- Yuhong Yin
8
Question 2 and solution
•  Read a file one char at a time and show the contents on the screen
• ifstream myFile; // declare an input file stream
  GetInputFile(myFile); // call GetInputFile (See slide 4)
  char ch; // declare a char variable
  while ( myFile.peek() != EOF ) { // test if at the End Of File
myFile.get(ch); // read one character a time
cout << ch; // print the character onto screen
  }
  myFile.close(); // close the file stream