I'm trying to build something that will read certain bits of a text file so far i've come up with this but i'm stumped on it the text file is a log file but i only want certain areas such as drive,start/finish,date,size can anybody help?
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
ifstream myfile ("sbsbackuplog01.txt");
if (myfile.is_open())
{
while (! myfile.eof() )
{
getline (myfile,Bytes);
cout << line << endl;
}
myfile.close();
}else
cout << "Unable to open file";
i only want certain areas such as drive,start/finish,date,size
I take it the file is formatted. As you should already know a log file has sequential access. So you must read each line and use your knowledge of the format to select the fields you're interested.
There is a set to standard tools on POSIX that already do this sort of thing. If you post the format, we can make some recomendations.