void Reporter::capture( Population& p, const int& i){ //assure we can read if( ! datafile.good()){ fail = true; return;} //setup char* buffer = new char[50]; //write the first part sprintf( buffer, "%d, %f, %f, %f", i, p.best(), p.average(), p.worst()); datafile << buffer << std::endl; //done, clean up datafile.flush(); delete[] buffer;}