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
|
bool nostop=true;
int compteur=0;
while(nostop)
{
if(compteur>=200000)
nostop=false;
else
compteur++;
if (INPUT.good())
{
for(int h=0; h<3; h++) //ça c'est pas obligé, c'est pour écumer un peu...j'ai tenté une solution....ingrate.
{getline (INPUT,str,'\n');}
//vérifier que c'est une chaine attendue
if(str.compare(0,4,sD)==0 && str.compare(8,2,sM)==0 && str.compare(14,4,sF)==0)
{//extraire les infos
CANALss<<str.substr(4,4)<<endl;
CANALss>>hex>>X_od;
CANALss<<str.substr(10,4)<<endl;
CANALss>>hex>>Y_od;
cout<<"détection : "<<str<<endl<<"X:"<<X_od<<endl<<"Y:"<<Y_od<<endl;
//TOUTES les commandes qu'on veut faire à partir de ces infos.
}
}
/*else
cout<<compteur<<" : bad connexion"<<endl;*/
} |
Partager