#include <iostream>
#include <fstream>//using standart c++ lib
#include <string.h>
using namespace std;
int main()
{
string fname;//file name
cout << "Please enter file name and type(.txt): ";//for example "input.txt"
cin >> fname;
ifstream file(fname);
if (!file)
return cout << "File not found!!!\n", 0;
int numChars = 0;//number characters readed file
while (!file.eof())
{
char ch;
file >> ch;
numChars++;
}
cout << "number of characters read from the file: " << numChars << endl;
file.close();//close file procces
return 0;
}
Comments
Leave a comment