Why get the last char twice?

#include <iostream>
#include <fstream>

using namespace std;

int main (int argc, char* argv[])
{
  if (argc == 1) return 0;
  
  char c;

  for (int i = 1; i < argc; i++)
  {
    ifstream input;

    input.open(argv[i]);

    while (!input.eof())
    {
      input >> c;

      cout << c; 
    } 

    input.close();
  }

  return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.