jinyistudio Well-Known Member Licensed User Longtime User Mar 17, 2016 #1 Hi How to move a character to array element as following packet(1) ? Dim packet(64) As Byte packet(0) = ENQ packet(1) = '0'
Hi How to move a character to array element as following packet(1) ? Dim packet(64) As Byte packet(0) = ENQ packet(1) = '0'
Cableguy Expert Licensed User Longtime User Mar 17, 2016 #2 Since you are casting your array as byte, it will expect bytes as values. When you enclose a value with quote signs, it becomes a string! Upvote 0
Since you are casting your array as byte, it will expect bytes as values. When you enclose a value with quote signs, it becomes a string!
Erel B4X founder Staff member Licensed User Longtime User Mar 17, 2016 #3 You can use Asc("0") to get the code point of the character. Upvote 0
jinyistudio Well-Known Member Licensed User Longtime User Mar 18, 2016 #4 Erel said: You can use Asc("0") to get the code point of the character. Click to expand... Thank's and My longer code : B4X: private Sub ascii(ch As String) As Byte Dim data() As Byte data=ch.GetBytes("UTF8") Return data(0) End Sub Upvote 0
Erel said: You can use Asc("0") to get the code point of the character. Click to expand... Thank's and My longer code : B4X: private Sub ascii(ch As String) As Byte Dim data() As Byte data=ch.GetBytes("UTF8") Return data(0) End Sub