Affecter des valeurs d'un fichier .csv à un vector de type class
	
	
		Bonjour,
Serait-il possible de récupérer les valeurs du fichier .csv dans un vector de type class ?  (sans parler du problème de conversion des string en int ou double) .  C'est surtout la difficulté d'affecter "cell" à un membre de la class qui m'interroge...
Ou suis-je obligé de repartir avec un 'bête' tableau double entrée ?:cry: 
Merci de votre aide,
	Code:
	
| 12
 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
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 
 |  
class Tableau{
public:
	string colA;
	int colB;
	int colC;
	double colD;
	int colE;
	Tableau (string A, int B, int C, double D, int E)
		:colA(A), colB(B), colC(C), colD(D), colE(E) { }
};
 
int Ouverture(string nom_fichier){
 
	ifstream fichier;										
 
	string chemin = nom_fichier + ".csv" ;					
 
	fichier.open(chemin.c_str());							
 
	if (!fichier){											
		cout << "Erreur lors de l'ouverture du fichier " 
			 << chemin
			 << endl;
		system ("PAUSE");
		exit(1);
	}
 
	string ligne;
	int nb_lignes = 0;
	vector<Tableau>table;
 
	while (getline(fichier, ligne)){
		stringstream lineStream(ligne);
		string cell;
		int nb_cell = 0;
		if (nb_lignes > 0){
			while (getline(lineStream, cell, ';')){
				if (cell == "")
					cell = "0";
				++nb_cell;
				cout << nb_cell << " " << cell << "\t";
			}
		}
		cout << endl;
 
		++nb_lignes;
	}
 
	fichier.close();										
 
	return nb_lignes;									
} |