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 29 30 31 32 33 34 35 36 37 38 39 40 41
| void mnt::load(void)
{
float tmpx, tmpy, tmpz; // le x y z de chaque ligne
int tmpb; // le b correspondant x y z
string line, // contient la ligne qu'on est en train de lire
bcn; // on récupère d'abord la chaine qu'on va bidouiller pour virer le BCN,
// ouverture du fichier
ifstream fichierInput( "../../data/Balise.xyzb" );
// verification
if (!fichierInput)
cout << "\nt'es dans le caca avec ton fichier\n";
else
{
// on tente un truc rapide -> on met tout dans un buffer
stringstream buff;
buff << fichierInput.rdbuf();
// plus besoin du fichier donc
fichierInput.close();
cout << "Taille du buffer : " << buff.str().size() << '\n';
// cette boucle s'arrête dès qu'une erreur de lecture survient
while (getline(buff, line))
{
// on enregistre ligne par ligne mais evidemment faut sauter le "BCN,"
istringstream iss( line );
iss >> tmpx >> tmpy >> tmpz;
// comment choper que l'entier après le "," ???
getline (iss, bcn, ',');
getline (iss, bcn, ',');
istringstream iss2( bcn );
iss2 >> tmpb;
//cout << "\n on a enregistre " << tmpx << " " << tmpy << " " << tmpz << " " << tmpb << "\n";
}
}
} |
Partager