/*************************************************************************** *** FILE: fio.cpp *** AUTHOR: Daniel Dementiev *** DATE: Nov 14, 2003 *** DESCR: This file is short example of file inpup output for text fiels. *** It takes two file names as arguments, reads the complete *** contents of the first file, counts the number of letters 'a' *** and the number of all other character, and print the result *** on the screen abd into the other file. *** Example: *** c:> fio input.txt output.txt ***************************************************************************/ #include #include using namespace std; void main(int argc, char *argv[]) { ifstream inp; ofstream out; char ch; int a_cnt=0, o_cnt=0; if( argc > 1 ){ inp.open(argv[1]); if( inp.fail() ){ cerr<<"Error: cannot open file '"< 2 ){ out.open(argv[2], ios_base::out); if( out.fail() ){ cerr<<"Error: cannot open file '"<