#include <iostream>                    // cin, cout, >>, <<
#include <fstream>                     // ifstream, ofstream
#include <string>                      // string, getline()

// --- Open an ifstream interactively ---------------------

void InteractiveOpen(ifstream & theIFStream)
{
   cout << "Enter the name of the input file: ";
   string inputFileName;
   getline(cin, inputFileName);

   theIFStream.open(inputFileName.data());

   if (!theIFStream.is_open())
   {
      cerr << "\n***InteractiveOpen(): unable to open "
           << inputFileName << endl;
      exit(1);
   }
}

// --- Open an ofstream interactively ---------------------

void InteractiveOpen(ofstream & theOFStream)
{
   cout << "Enter the name of the output file: ";
   string outputFileName;
   getline(cin, outputFileName);

   theOFStream.open(outputFileName.data());

   if (!theOFStream.is_open())
   {
      cerr << "\n***InteractiveOpen(): unable to open "
           << outputFileName << endl;
      exit(1);
   }
}


