B4R Question Astream.Write & long numbers

Tayfur

Well-Known Member
Licensed User
Longtime User
I used this code for long data
B4X:
Dim ff As String
ff=Rnd(10,99)
Astream.Write(ff)
its works...
but it s more changes types...and alot of codes..


B4X:
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
Use RandomAccessFile instead of ByteConverter.
Build the message and then write it.
B4X:
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
Top