All pastes #247790 Raw Edit

Sans titre

public cpp v1 · immutable
#247790 ·published 2006-11-13 21:55 UTC
rendered paste body
#include <iostream>#include <fstream>using namespace std;int  main(){  fstream f;  string ligne;  string changement="chat9.x-echo.com";  string tmp;  string::size_type pos;  f.open("./CONFIG",ios_base::in | ios_base::out);  if(!f.is_open()) cerr<<"l'ouverture du fichier ""CONFIG"" a échouée"<<endl;  while(!f.eof()) {	getline(f,ligne);	pos = ligne.find('=', 0);	if(pos==string::npos) {		cerr<<"le ""="" n'a pas été trouvé."<<endl;		break;		return 0;		}	tmp = ligne.substr(0,pos);	if(tmp == "SERVER") {		f.seekg(pos+1);		f<<changement<<endl;		break;		}	}  f.close();  ligne.clear();  tmp.clear();return 0;}