vecino Well-Known Member Licensed User Longtime User Mar 1, 2014 #1 Hello, how I can fix this? Example: Code: Copy Dim fNum As Long = 856987458515 Dim cStr As String ' cStr = Bit.ToHexString( fNum ) Log("cStr: "&cStr) ' cStr: 886edbd3 I think the result is: C7886EDBD3 Thanks and regards.
Hello, how I can fix this? Example: Code: Copy Dim fNum As Long = 856987458515 Dim cStr As String ' cStr = Bit.ToHexString( fNum ) Log("cStr: "&cStr) ' cStr: 886edbd3 I think the result is: C7886EDBD3 Thanks and regards.
DonManfred Expert Licensed User Longtime User Mar 1, 2014 #2 Code: Copy Dim bc As ByteConverter Dim val(1) As Long val(0) = 856987458515 Log(bc.HexFromBytes(bc.LongsToBytes((val)))) logs 000000C7886EDBD3 Click to expand... "Bit" works with an int, not long. But your value doesnt fix to an int See documentation of Bit.ToHexString Last edited: Mar 1, 2014 Upvote 0
Code: Copy Dim bc As ByteConverter Dim val(1) As Long val(0) = 856987458515 Log(bc.HexFromBytes(bc.LongsToBytes((val)))) logs 000000C7886EDBD3 Click to expand... "Bit" works with an int, not long. But your value doesnt fix to an int See documentation of Bit.ToHexString
vecino Well-Known Member Licensed User Longtime User Mar 1, 2014 #3 Hello, thank you Then, to convert a long to octal, binary, etc.. What function is used? Thanks and regards. Upvote 0
Hello, thank you Then, to convert a long to octal, binary, etc.. What function is used? Thanks and regards.
DonManfred Expert Licensed User Longtime User Mar 1, 2014 #4 Find out how you can convert each long into INTs with an int as base you can use the bit-command Bit.ToBinaryString(intvalue) Bit.ToOctalString(intvalue) Dim data() As Byte data = bc.LongsToBytes(val) data now hold the single bytes... but i dont know how to convert it to an int which can be used with bit-command. Upvote 0
Find out how you can convert each long into INTs with an int as base you can use the bit-command Bit.ToBinaryString(intvalue) Bit.ToOctalString(intvalue) Dim data() As Byte data = bc.LongsToBytes(val) data now hold the single bytes... but i dont know how to convert it to an int which can be used with bit-command.
vecino Well-Known Member Licensed User Longtime User Mar 1, 2014 #5 I'm embarrassed to say this, but I do not understand what you said, I used the translate.google and nor understand. I think it is time for me to learn English Upvote 0
I'm embarrassed to say this, but I do not understand what you said, I used the translate.google and nor understand. I think it is time for me to learn English
vecino Well-Known Member Licensed User Longtime User Mar 3, 2014 #6 I already understood, thanks Upvote 0
S SPLatMan Member Licensed User Longtime User Jul 22, 2014 #7 I just tried to wrap the above Long->Hex solution into a sub, but got a weird compile error. So I pasted just the sample code into my sub like so: Code: Copy Sub LongToHexStr(L As Long) As String Dim bc As ByteConverter Dim val(1) As Long Val(0) = 856987458515 '<<<<<<<<<<< Log(bc.HexFromBytes(bc.LongsToBytes((Val)))) End Sub What I get is an error on the highlighted line: Parsing code. 0.08 Compiling code. Error Error compiling program. Error description: Syntax error. Occurred on line: 2214 Val(0) = 856987458515 '<<<<<<<<<<< Word: = Click to expand... What's wrong with that line? What does Word: = Click to expand... mean? Upvote 0
I just tried to wrap the above Long->Hex solution into a sub, but got a weird compile error. So I pasted just the sample code into my sub like so: Code: Copy Sub LongToHexStr(L As Long) As String Dim bc As ByteConverter Dim val(1) As Long Val(0) = 856987458515 '<<<<<<<<<<< Log(bc.HexFromBytes(bc.LongsToBytes((Val)))) End Sub What I get is an error on the highlighted line: Parsing code. 0.08 Compiling code. Error Error compiling program. Error description: Syntax error. Occurred on line: 2214 Val(0) = 856987458515 '<<<<<<<<<<< Word: = Click to expand... What's wrong with that line? What does Word: = Click to expand... mean?
MaFu Well-Known Member Licensed User Longtime User Jul 22, 2014 #8 Code: Copy Val[0] = 856987458515 Upvote 0
S SPLatMan Member Licensed User Longtime User Jul 23, 2014 #9 Thanks MaFu. You mean square brackets? Made no difference. But I did discover the problem after a good night's sleep ... I have a function called Val() elsewhere in my program! What misled me was that the error message pointed at the line using array variable Val(0). If the declaration had been flagged as Dupe Def then it would have been clearer. Upvote 0
Thanks MaFu. You mean square brackets? Made no difference. But I did discover the problem after a good night's sleep ... I have a function called Val() elsewhere in my program! What misled me was that the error message pointed at the line using array variable Val(0). If the declaration had been flagged as Dupe Def then it would have been clearer.