PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → est-ce que quelqu'un peux m'aider????
est-ce que quelqu'un peux m'aider????
Débuté par Baptiste, 27 sep. 2004 17:28 - 1 réponse
Posté le 27 septembre 2004 - 17:28
Voila un fonction vb que je n'arrive pas a passer w langage:
en gros il faut convertir un long en une chaine binaire

Function LongToBytes(ByVal Value As Long) As String

' Convert long value to string of bytes.
' IN: Value, long value
' OUT: LongToBytes, string with long value converted to bytes
' Known bugs:
' Version Date Who Comment
' 00.00.000 010715 CFO Created
'*************************************************************************
Dim lsHex As String, i As Integer
Dim cHexa As String

lsHex = Right("00000000" & Hex(Value), 8)
For i = 1 To 7 Step 2
cHexa = "&H" & Mid(lsHex, i, 2)
LongToBytes = ChrB(CInt(cHexa)) & LongToBytes
Next
End Function
Posté le 05 octobre 2004 - 00:41
"Baptiste" <b.cazard@adi-soft.com> écrivait
news:415814a6@news.pcsoft.fr:


Voila un fonction vb que je n'arrive pas a passer w langage:
en gros il faut convertir un long en une chaine binaire

Function LongToBytes(ByVal Value As Long) As String

' Convert long value to string of bytes.
' IN: Value, long value
' OUT: LongToBytes, string with long value converted to bytes
' Known bugs:
' Version Date Who Comment
' 00.00.000 010715 CFO Created
'**********************************************************************
***
Dim lsHex As String, i As Integer
Dim cHexa As String

lsHex = Right("00000000" & Hex(Value), 8)
For i = 1 To 7 Step 2
cHexa = "&H" & Mid(lsHex, i, 2)
LongToBytes = ChrB(CInt(cHexa)) & LongToBytes
Next
End Function



Salut,

Tu veux une chaine avec la valeur hexa c'est ça ?
Dans ce cas c'est tres simple :

NumériqueVersChaine(1234, "X")

--
En esperant t'avoir aidé.
ted