merci
Code : Tout sélectionner
Procedure Int_IP(IP.s)
Protected a1,a2,a3,a4
Protected b1.s,b2.s,b3.s,b4.s
Protected c1.s,c2.s,c3.s,c4.s
a1=Val(Left(IP,FindString(IP,".",0)-1))
IP=Right(IP,Len(IP)-FindString(IP,".",0))
a2=Val(Left(IP,FindString(IP,".",0)-1))
IP=Right(IP,Len(IP)-FindString(IP,".",0))
a3=Val(Left(IP,FindString(IP,".",0)-1))
IP=Right(IP,Len(IP)-FindString(IP,".",0))
a4=Val(IP)
Debug "-----Valeur décimal-----"
Debug a1
Debug a2
Debug a3
Debug a4
b1=Bin(a1)
b2=Bin(a2)
b3=Bin(a3)
b4=Bin(a4)
Debug "-----Valeur binaire-----"
Debug b1
Debug b2
Debug b3
Debug b4
If Len(b1)<>8
c1.s=RSet(b1,8-Len(b1)+1,"0")
Else
c1=b1
EndIf
If Len(b2)<>8
c2.s=RSet(b2,8-Len(b2)+1,"0")
Else
c2=b2
EndIf
If Len(b3)<>8
c3.s=RSet(b3,8-Len(b3)+1,"0")
Else
c3=b3
EndIf
If Len(b4)<>8
c4.s=RSet(b4,8-Len(b4)+1,"0")
Else
c4=b4
EndIf
Debug "-----Valeur binaire sur un octect-----"
Debug c1
Debug c2
Debug c3
Debug c4
c.s=c1+c2+c3+c4
Debug "-----Valeurs concaténées-----"
Debug c
ProcedureReturn c
EndProcedure
d=Int_IP("192.168.0.1")