All pastes #410906 Raw Edit

Unnamed

public text v1 · immutable
#410906 ·published 2007-03-26 19:10 UTC
rendered paste body
int filldatabase(string s, database &db)
{
  string line;
  ifstream fdatabase(s.c_str(), ios::in);
  if (fdatabase.is_open())
  {
    while (! fdatabase.eof() )
    {
      // write line from file into database
      getline(fdatabase,line);
      db.addLine(line);
    }
    fdatabase.close();
  }
  else
  { 
  	cout << "file not found - will be created!";
  	ofstream fdatabase(s.c_str(), ios::app);
  	//fdatabase.is_open();
  	fdatabase.close();
  	return 1; 
  }
  return 0;
}