// readNames.cc read names from a file
// P. Conrad for CISC181 06S   02/17/06

#include <iostream>
#include <fstream>

using namespace std;

// following line of code changes every instance of NAMELEN
// to be 32

// the terminology for such a line is
//    #define constant
//    more generally, anything that starts with # is a pre-processor directive

// 

#define NAMELEN 32

#define INPUT_FILENAME "names.dat"

int main(void)
{
  
  ifstream infile(INPUT_FILENAME, ios::in);

  if (!infile)
    {
      cerr << "Could not open "<< INPUT_FILENAME << endl; // !??!?
      exit(1);
    }

  char name[NAMELEN];

  infile >> name;
  
  while (!infile.eof())
    {
      cout << "Hello " << name << endl;
      infile >> name;
    }

  infile.close(); // close the file when we are done with it

  return 0; // successful completion.

}

