// FILE PROCESSING 2
#include
#include
#include
main()
{
char x;
ifstream infile;
char I_file[13];
int chrs = 0;
int eoln = 0;
cout << "Name of file to read from: ";
cin.get(I_file,13);
cin.ignore(80,'\n');
infile.open(I_file, ios::in);
cout << "Name of file to copy to: ";
cin.get(I_file,13);
cin.ignore(80,'\n');
if (!infile)
{
cout << "Error in opening file.\n";
return 0;
}
infile.unsetf(ios::skipws);
while (!infile.eof())
{
infile >> x;
if (!infile.eof())
{
if (x == '\n')
{ eoln++; }
chrs++;
}
}
cout << "The number of the characters is " << chrs << endl;
cout << "The number of lines is " << eoln;
infile.close();
cin.ignore();
return 0;
}