Tayfur Well-Known Member Licensed User Longtime User Oct 1, 2016 #1 I used this code for long data Code: Dim ff As String ff=Rnd(10,99) Astream.Write(ff) its works... but it s more changes types...and alot of codes.. Code: Astream.Write(bc.LongsToBytes(Array As Long (Rnd(10,99)))) this code dont work!!! @Erel; please add for ByteConverter boolenTObyte LongTObyte
I used this code for long data Code: Dim ff As String ff=Rnd(10,99) Astream.Write(ff) its works... but it s more changes types...and alot of codes.. Code: Astream.Write(bc.LongsToBytes(Array As Long (Rnd(10,99)))) this code dont work!!! @Erel; please add for ByteConverter boolenTObyte LongTObyte
Erel B4X founder Staff member Licensed User Longtime User Oct 2, 2016 #2 Use RandomAccessFile instead of ByteConverter. Build the message and then write it. Code: Dim raf As RandomAccessFile Dim buffer(7) As Byte raf.Initialize(buffer, True) raf.WriteByte(100, raf.CurrentPosition) raf.WriteULong32(Millis, raf.CurrentPosition) raf.WriteInt16(23232, raf.CurrentPosition) astream.Write(buffer) Upvote 0
Use RandomAccessFile instead of ByteConverter. Build the message and then write it. Code: Dim raf As RandomAccessFile Dim buffer(7) As Byte raf.Initialize(buffer, True) raf.WriteByte(100, raf.CurrentPosition) raf.WriteULong32(Millis, raf.CurrentPosition) raf.WriteInt16(23232, raf.CurrentPosition) astream.Write(buffer)