victormedranop Well-Known Member Licensed User Longtime User Jan 15, 2018 #1 Hi, I am working with byte converter library. but I have some problems converting byte to and 8 bit. I am using B4X: Dim s As Short = 99 Dim comando() As Byte = bc.ShortsToBytes(Array As Short(s)) the result of this is 99 in byte of course + 0 byte too but I only need one byte this represent a low byte and high byte. If I use int I use 4 bit. if I use double that's 8 bit, does not work. Any help will be appreciated.
Hi, I am working with byte converter library. but I have some problems converting byte to and 8 bit. I am using B4X: Dim s As Short = 99 Dim comando() As Byte = bc.ShortsToBytes(Array As Short(s)) the result of this is 99 in byte of course + 0 byte too but I only need one byte this represent a low byte and high byte. If I use int I use 4 bit. if I use double that's 8 bit, does not work. Any help will be appreciated.
OliverA Expert Licensed User Longtime User Jan 16, 2018 #2 A "short" variable is two bytes, and therefore ShortsToBytes seems to work as intended. How about declaring it as a Byte? Then you would not need ByteConverter anymore. Link: (https://www.b4x.com/android/forum/threads/data-type-and-range.8062/#post-45511) Upvote 0
A "short" variable is two bytes, and therefore ShortsToBytes seems to work as intended. How about declaring it as a Byte? Then you would not need ByteConverter anymore. Link: (https://www.b4x.com/android/forum/threads/data-type-and-range.8062/#post-45511)