1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
void Joueur::lire_fichierjoueur()
{
std::ifstream entree;
entree.open("Joueur.txt",std::ios::in);
if(entree.fail()){
std::cerr<<"Fail _ Impossible de lire le fichier joueur.txt\n";
throw 8;
}
if(entree.bad()){
std::cerr<<"Bad _ Impossible de lire le fichier joueur.txt\n";
throw 8;
}
std::string ligne;
while(std::getline(entree,ligne))
{
std::istringstream iss(ligne);
std::getline( iss, nom, ';' ); // type(nom)==std::string
std::getline( iss, prenom, ';' ); // type(prenom)==std::string
std::getline( iss, taille, ';' ); // type(taille)==std::string
std::getline( iss, age, ';' ); // type(age)==std::string
std::getline( iss, adresse, ';' ); // type(adresse)==std::string
std::getline( iss, ville, ';' );// type(ville)==std::string
std::getline( iss, telephone, ';' ); // type(telephone)==std::string
std::getline( iss, sexe, ';' ); // type(sexe)==std::string
}
entree.close(); |
Partager