Révision 168
Ajouté par megoutteno il y a presque 4 ans
branch/Gouttenoire/sp4a12/main.c | ||
---|---|---|
int trame_cmp(char* trame,char* type)
|
||
{
|
||
int i = 0, a = 0;
|
||
if (trame[i+1] == type[i])
|
||
for (i=0;i<5;i++)
|
||
{
|
||
if (trame[i+1] == type[i])
|
||
{
|
||
i++;
|
||
|
||
}
|
||
else if ((trame[i+1] == '\0') || (type[i] == '\0') || (trame[i+1] == ','))
|
||
{
|
||
a = trame[i] - type[i-1];
|
||
a = trame[i] - type[i];
|
||
|
||
}
|
||
else
|
||
{
|
||
a = trame[i+1] - type[i];
|
||
}
|
||
if (a==0)
|
||
}
|
||
if (a==0)
|
||
{
|
||
return 1;
|
||
}
|
||
... | ... | |
return 0;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
... | ... | |
if (trame_cmp("$APRMC...", "GPGGA")!=0){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}*/
|
||
}*/
|
||
printf ("trame_cmp = %d \n",trame_cmp("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D","GPGGA"));
|
||
printf ("trame_cmp = %d \n",trame_cmp("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D","GPDGA"));
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
Formats disponibles : Unified diff
Question 5: vérification de la fonction trame