#include< iostream.h >
#include< fstream.h >
#include< iomanip.h >
#include< stdlib.h >
#include< string.h >
int main(){
char logfile[80];
cout<<"ACRserve Missed agents log scan, Version 1.6"<< endl;
cout<<"This program is specifically for finding"<< endl;
cout<<"missed agents in PC backups. It should be modified for general use!"<< endl;
cout<<"Please enter the log name: ";
cin>> logfile;
cout<< endl <<"You entered: "<< logfile;
cout<< endl <<"This is: "<< logfile;
ofstream outfile("failed.txt");
ifstream infile(logfile);
char error[] = "E8511";
cout<< "Scanning error log for missed agents..." << endl << endl;
int errorCount = 0;
char data[40];
char endmark[10] = "Operation";
do{
infile>> data;
if(strcmp(data, error)==0){
errorCount++;
for(int i=0; i<8; i++){
infile >> data;}
for(int j=1; j < 7; j++){
cout << data[j];
outfile << data[j];}
cout << endl;
outfile << endl;
}
}while(strcmp(data, endmark)!=0);
outfile << endl << "ARCserve missed " << errorCount <<" agents." << endl;
cout << endl << "ARCserve missed "<< errorCount<< " agents."<< endl;
infile.close;
outfile.close;
return 0;
}
|