That is a good improvement, but an even better solution is to use the global getline, instead of the member getline. The global getline will read a line of _any_ length and store it in a string object, like
sring log_line;
ifstream log_file("access.log");
while(!log_file.eof())
{
getline(log_file,log_line)
cout<<log_line<<endl;
}
log_file.close();
Main Topics
Browse All Topics





by: MafaldaPosted on 2003-02-28 at 03:27:56ID: 8040895
1) Don't you mean BLANKS ?
2) use getline
char buf[256]; // max line in file
logfile.getline(buf, 256);