// readFromFileDemo.cc P. Conrad for CISC220 06J 06/06/06  aaaaah!

#include <iostream>
#include <fstream>
using namespace std;


int main(int argc, char *argv[])
{

  const int BUFSIZE = 1024;

  if ( argc != 2  ) // if not exactly two things on cmd line
    {
      // then print an error message and stop

      cerr << "Usage: " << argv[0] << " filename" << endl;
      exit(1);
    }

  // now open the file

  ifstream infile(argv[1],ios::in);

  if (!infile)
    {
      cerr << "Error: file " << argv[1] << " not found" << endl;
      exit(2);
    }
  
  char buffer[BUFSIZE];

  infile.getline(buffer,BUFSIZE);
  while (!infile.eof() )
    {
      // process the data we just read

      // use the constructor for the class
      // pass into that constructor the input line we read.
      
      infile.getline(buffer,BUFSIZE);
    }



  // successful completion!



  return (0);

}
