title: Setting up an ifstream, getting 'error: expected initializer before ‘.’ token'
body: <p>I received the following error in my compiler:</p>
  
  <p>AccountDB.cpp: In member function ‘void AccountDB::processTransactions(const char*)’:
  AccountDB.cpp:89:9: error: expected initializer before ‘.’ token
  inFile2.open(transactFile);
           ^ (the carrot is over the period)</p>
  
  <p>This is the relevant function. From similar errors on here, I suspect it has something to do with a namespace, but I'm not sure which. The function is supposed to read the date, account number and amount of a transaction and then process it using other nested functions.</p>
  
  <pre><code>void AccountDB::processTransactions(const char* transactFile)
  {
  //set up the input stream from the text file
  ifstream inFile2;
  //set up the variables to be read from text file
  char date[6];
  char type;
  char accountnumber[20];
  double amount, 
  
  //open the file
  inFile2.open(transactFile);
  //standard check for file and exit if it doesn't exist
  if(!inFile2)
  {
      cout &lt;&lt; "Error, input file could not be opened.\n";
      exit(1);
  }
  //Creates a header for listing transactions
  cout &lt;&lt; setw(5) &lt;&lt; "Date"
       &lt;&lt; setw(25) &lt;&lt; "Account Number"
       &lt;&lt; setw(5) &lt;&lt; "Type"
       &lt;&lt; setw(8) &lt;&lt; "Amount"
       &lt;&lt; setw(30) &lt;&lt; "New Balance"
       &lt;&lt; endl;
       inFile2 &gt;&gt; date;
       while (inFile2)
       {
          inFile2 &gt;&gt; accountnumber &gt;&gt; type &gt;&gt; amount;
          cout &lt;&lt; setw(5) &lt;&lt; date
               &lt;&lt; setw(25) &lt;&lt; accountnumber[20]
               &lt;&lt; setw(5) &lt;&lt; type
               &lt;&lt; setw(8) &lt;&lt; amount;
          int relevantAccount = searchForAccount(accountnumber);
          if (relevantAccount != -1)
          {
              if (type == 'P')
              {
                  credArray[relevantAccount].processPayment(amount);
                  cout &lt;&lt; setw(30) &lt;&lt; credArray[relevantAccount].getBalance() &lt;&lt; endl;
              }
              else
              {
                  bool chargestatus = credArray[relevantAccount].processCharge(amount);
                  if (chargestatus = 1)
                      cout &lt;&lt; setw(30) &lt;&lt; credArray[relevantAccount].getBalance() &lt;&lt; endl;
                  else
                      cout &lt;&lt; "Credit limit exceeded" &lt;&lt; endl;
              }
          }
          else
              cout &lt;&lt; "Invalid account number" &lt;&lt; endl;   
          inFile2 &gt;&gt; date;
      }
      cout &lt;&lt; "End of transaction list." &lt;&lt; endl;
  </code></pre>
  
  <p>}</p>