Problème de compréhension

Résolu
NicoIRIS Messages postés 33 Date d'inscription mardi 18 avril 2006 Statut Membre Dernière intervention 1 décembre 2009 - 16 mai 2008 à 16:15
NicoIRIS Messages postés 33 Date d'inscription mardi 18 avril 2006 Statut Membre Dernière intervention 1 décembre 2009 - 19 mai 2008 à 07:50
Bonjour,

Je me suis mis au delphi il y a environ une semaine. je me trouve devant un problème de compréhension du code suivant :

If ((reponse=#15) Or (LeftStr(reponse, 1)=#$15)
     Or (reponse=#6#$15))
      Then......
end;

je souhaiterai savoir ce que signifie "reponse=#6#$15"

Merci de votre aide

4 réponses

Guillemouze Messages postés 991 Date d'inscription samedi 25 octobre 2003 Statut Membre Dernière intervention 29 août 2013 6
16 mai 2008 à 18:08
#15 represente un Char correspondant au code ascii 15
$6  represente le chiffre hexadecimal 6
donc je pense que #$6 represente le char correspondant au code ascii 6 (en hexa)
3
f0xi Messages postés 4205 Date d'inscription samedi 16 octobre 2004 Statut Modérateur Dernière intervention 12 mars 2022 35
17 mai 2008 à 06:34
If                          --> si
((reponse=#15)              --> reponse est egal a SI
Or                          --> ou
(LeftStr(reponse, 1)=#$15)  --> reponse est egal a NAK
Or                          --> ou
(reponse=#6#$15))           --> reponse est egal a ACK+NAK
Then                        --> alors faire
end                         --> fin



#6#$15 = caractere ACK + NAK (acknowledge, negative aknowledge)

notation en Delphi :

'A'  > caractere (char) ou chaine (string) "A"
#65  > caractere (char) "A"
#$41 > caractere (char) "A" en hexa
#$1B  > caractere (char) ESCAPE en hexa
#$0D#$0A > retour a la ligne (string) (CR+LF) en hexa
#13#10 > retour a la ligne (string) (CR+LF) en decimal
$41  > nombre hexadecimal (65 en decimal)
65   > nombre entier
65.0 > nombre réel (flottant)
'65' > chaine (string) ou il est ecrit 65 (#54#53 ou #$36#$35)

<hr size="2" width="100%" />
3
Guillemouze Messages postés 991 Date d'inscription samedi 25 octobre 2003 Statut Membre Dernière intervention 29 août 2013 6
17 mai 2008 à 15:23
petite correction:
(LeftStr(reponse, 1)=#$15)  --> reponse commence par NAK
3
NicoIRIS Messages postés 33 Date d'inscription mardi 18 avril 2006 Statut Membre Dernière intervention 1 décembre 2009
19 mai 2008 à 07:50
Je vous remercie pour ces compléments d'informations...
Maintenant je comprends mieux le code
0
Rejoignez-nous