All pastes #198742 Raw Edit

Stuff

public text v1 · immutable
#198742 ·published 2006-10-12 04:28 UTC
rendered paste body
// APS105 Lab4Part2 10/11/06
// Geoffrey Lang
// 995155772
// langgeof@ecf.utoronto.ca

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

int main ()
{
        char current;
        int totalchar=0;
        ifstream in_stream;
        char filename[128];

        string << "Please enter the filename: ";
        cin >> filename;
        in_stream.open(filename);

        if(in_stream.fail())
        {
                cout << "Failed to open input file.\n";
                exit (1);
        }
        else
        {
                do
                {
                        cin.get(current);
                        cout.put(current);
                        totalchar++;
                } while (!cin.eof());

                cout << totalchar << " characters processed.\n";

                in_stream.close(filename);
        }
        return 0;
}